Track camera and flashlight usage in battery stats.
Bug: 15986092 Change-Id: I272ec070113a0bfc41c637c45a6e1a2ab346e87b
This commit is contained in:
parent
bfb1f1cc83
commit
d47da60836
@ -36,6 +36,12 @@ public:
|
|||||||
virtual void noteStopAudio(int uid) = 0;
|
virtual void noteStopAudio(int uid) = 0;
|
||||||
virtual void noteResetVideo() = 0;
|
virtual void noteResetVideo() = 0;
|
||||||
virtual void noteResetAudio() = 0;
|
virtual void noteResetAudio() = 0;
|
||||||
|
virtual void noteFlashlightOn(int uid) = 0;
|
||||||
|
virtual void noteFlashlightOff(int uid) = 0;
|
||||||
|
virtual void noteStartCamera(int uid) = 0;
|
||||||
|
virtual void noteStopCamera(int uid) = 0;
|
||||||
|
virtual void noteResetCamera() = 0;
|
||||||
|
virtual void noteResetFlashlight() = 0;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NOTE_START_SENSOR_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
|
NOTE_START_SENSOR_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
|
||||||
@ -46,6 +52,12 @@ public:
|
|||||||
NOTE_STOP_AUDIO_TRANSACTION,
|
NOTE_STOP_AUDIO_TRANSACTION,
|
||||||
NOTE_RESET_VIDEO_TRANSACTION,
|
NOTE_RESET_VIDEO_TRANSACTION,
|
||||||
NOTE_RESET_AUDIO_TRANSACTION,
|
NOTE_RESET_AUDIO_TRANSACTION,
|
||||||
|
NOTE_FLASHLIGHT_ON_TRANSACTION,
|
||||||
|
NOTE_FLASHLIGHT_OFF_TRANSACTION,
|
||||||
|
NOTE_START_CAMERA_TRANSACTION,
|
||||||
|
NOTE_STOP_CAMERA_TRANSACTION,
|
||||||
|
NOTE_RESET_CAMERA_TRANSACTION,
|
||||||
|
NOTE_RESET_FLASHLIGHT_TRANSACTION
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -89,6 +89,47 @@ public:
|
|||||||
data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor());
|
data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor());
|
||||||
remote()->transact(NOTE_RESET_AUDIO_TRANSACTION, data, &reply);
|
remote()->transact(NOTE_RESET_AUDIO_TRANSACTION, data, &reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void noteFlashlightOn(int uid) {
|
||||||
|
Parcel data, reply;
|
||||||
|
data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor());
|
||||||
|
data.writeInt32(uid);
|
||||||
|
remote()->transact(NOTE_FLASHLIGHT_ON_TRANSACTION, data, &reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void noteFlashlightOff(int uid) {
|
||||||
|
Parcel data, reply;
|
||||||
|
data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor());
|
||||||
|
data.writeInt32(uid);
|
||||||
|
remote()->transact(NOTE_FLASHLIGHT_OFF_TRANSACTION, data, &reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void noteStartCamera(int uid) {
|
||||||
|
Parcel data, reply;
|
||||||
|
data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor());
|
||||||
|
data.writeInt32(uid);
|
||||||
|
remote()->transact(NOTE_START_CAMERA_TRANSACTION, data, &reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void noteStopCamera(int uid) {
|
||||||
|
Parcel data, reply;
|
||||||
|
data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor());
|
||||||
|
data.writeInt32(uid);
|
||||||
|
remote()->transact(NOTE_STOP_CAMERA_TRANSACTION, data, &reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void noteResetCamera() {
|
||||||
|
Parcel data, reply;
|
||||||
|
data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor());
|
||||||
|
remote()->transact(NOTE_RESET_CAMERA_TRANSACTION, data, &reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void noteResetFlashlight() {
|
||||||
|
Parcel data, reply;
|
||||||
|
data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor());
|
||||||
|
remote()->transact(NOTE_RESET_FLASHLIGHT_TRANSACTION, data, &reply);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_META_INTERFACE(BatteryStats, "com.android.internal.app.IBatteryStats");
|
IMPLEMENT_META_INTERFACE(BatteryStats, "com.android.internal.app.IBatteryStats");
|
||||||
@ -155,6 +196,46 @@ status_t BnBatteryStats::onTransact(
|
|||||||
reply->writeNoException();
|
reply->writeNoException();
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
} break;
|
} break;
|
||||||
|
case NOTE_FLASHLIGHT_ON_TRANSACTION: {
|
||||||
|
CHECK_INTERFACE(IBatteryStats, data, reply);
|
||||||
|
int uid = data.readInt32();
|
||||||
|
noteFlashlightOn(uid);
|
||||||
|
reply->writeNoException();
|
||||||
|
return NO_ERROR;
|
||||||
|
} break;
|
||||||
|
case NOTE_FLASHLIGHT_OFF_TRANSACTION: {
|
||||||
|
CHECK_INTERFACE(IBatteryStats, data, reply);
|
||||||
|
int uid = data.readInt32();
|
||||||
|
noteFlashlightOff(uid);
|
||||||
|
reply->writeNoException();
|
||||||
|
return NO_ERROR;
|
||||||
|
} break;
|
||||||
|
case NOTE_START_CAMERA_TRANSACTION: {
|
||||||
|
CHECK_INTERFACE(IBatteryStats, data, reply);
|
||||||
|
int uid = data.readInt32();
|
||||||
|
noteStartCamera(uid);
|
||||||
|
reply->writeNoException();
|
||||||
|
return NO_ERROR;
|
||||||
|
} break;
|
||||||
|
case NOTE_STOP_CAMERA_TRANSACTION: {
|
||||||
|
CHECK_INTERFACE(IBatteryStats, data, reply);
|
||||||
|
int uid = data.readInt32();
|
||||||
|
noteStopCamera(uid);
|
||||||
|
reply->writeNoException();
|
||||||
|
return NO_ERROR;
|
||||||
|
} break;
|
||||||
|
case NOTE_RESET_CAMERA_TRANSACTION: {
|
||||||
|
CHECK_INTERFACE(IBatteryStats, data, reply);
|
||||||
|
noteResetCamera();
|
||||||
|
reply->writeNoException();
|
||||||
|
return NO_ERROR;
|
||||||
|
} break;
|
||||||
|
case NOTE_RESET_FLASHLIGHT_TRANSACTION: {
|
||||||
|
CHECK_INTERFACE(IBatteryStats, data, reply);
|
||||||
|
noteResetFlashlight();
|
||||||
|
reply->writeNoException();
|
||||||
|
return NO_ERROR;
|
||||||
|
} break;
|
||||||
default:
|
default:
|
||||||
return BBinder::onTransact(code, data, reply, flags);
|
return BBinder::onTransact(code, data, reply, flags);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user