cmsdk: send intent to intialize CMHW

Ref: OPO-513

Change-Id: Iedd88bfad12b8f257bb792bf024d8eefa92b321c
Signed-off-by: Roman Birg <roman@cyngn.com>
This commit is contained in:
Roman Birg 2016-02-24 08:58:39 -08:00 committed by Gerrit Code Review
parent c2efaa7794
commit e3c966861f
3 changed files with 23 additions and 1 deletions

View File

@ -16,7 +16,7 @@
package org.cyanogenmod.platform.internal;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
@ -347,6 +347,16 @@ public class CMHardwareService extends SystemService implements ThermalUpdateCal
publishBinderService(CMContextConstants.CM_HARDWARE_SERVICE, mService);
}
@Override
public void onBootPhase(int phase) {
if (phase == PHASE_BOOT_COMPLETED) {
Intent intent = new Intent(cyanogenmod.content.Intent.ACTION_INITIALIZE_CM_HARDWARE);
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
mContext.sendBroadcast(intent,
cyanogenmod.platform.Manifest.permission.HARDWARE_ABSTRACTION_ACCESS);
}
}
@Override
public void onStart() {
if (ThermalMonitor.isSupported()) {

View File

@ -23,6 +23,7 @@
android:sharedUserLabel="@string/cyanogenmod_system_label">
<protected-broadcast android:name="cyanogenmod.intent.action.SCREEN_CAMERA_GESTURE" />
<protected-broadcast android:name="cyanogenmod.intent.action.INITIALIZE_CM_HARDWARE" />
<!-- Must be required by an, to ensure that only the system can bind to it.
@hide -->

View File

@ -77,4 +77,15 @@ public class Intent {
public static final String ACTION_SCREEN_CAMERA_GESTURE =
"cyanogenmod.intent.action.SCREEN_CAMERA_GESTURE";
/**
* Broadcast action: perform any initialization required for CMHW services.
* Runs when the service receives the signal the device has booted, but
* should happen before {@link android.content.Intent#ACTION_BOOT_COMPLETED}.
*
* Requires {@link cyanogenmod.platform.Manifest.permission#HARDWARE_ABSTRACTION_ACCESS}.
* @hide
*/
public static final String ACTION_INITIALIZE_CM_HARDWARE =
"cyanogenmod.intent.action.INITIALIZE_CM_HARDWARE";
}