Add config_wearServiceComponent to start the WearService from system server.
Also Cp'ing changes in ag/19338309 together. Test: tested locally, service starting as expected. Bug: 267404564 Change-Id: Idf26fd9408290263f791b8eb23689368064459db
This commit is contained in:
committed by
Himanshi Jain
parent
0e8ed85612
commit
71c8ea7da6
@@ -2193,6 +2193,9 @@
|
||||
<!-- The name of the package that will hold the system financed device controller role. -->
|
||||
<string name="config_systemFinancedDeviceController" translatable="false">com.android.devicelockcontroller</string>
|
||||
|
||||
<!-- The component name of the wear service class that will be started by the system server. -->
|
||||
<string name="config_wearServiceComponent" translatable="false"></string>
|
||||
|
||||
<!-- The name of the package that will handle updating the device management role. -->
|
||||
<string name="config_devicePolicyManagementUpdater" translatable="false"></string>
|
||||
|
||||
|
||||
@@ -4926,6 +4926,7 @@
|
||||
<java-symbol type="array" name="config_displayShapeArray" />
|
||||
|
||||
<java-symbol type="bool" name="config_stopSystemPackagesByDefault"/>
|
||||
<java-symbol type="string" name="config_wearServiceComponent" />
|
||||
|
||||
<!-- Whether to show weather on the lockscreen by default. -->
|
||||
<java-symbol type="bool" name="config_lockscreenWeatherEnabledByDefault" />
|
||||
|
||||
@@ -38,6 +38,7 @@ import android.app.INotificationManager;
|
||||
import android.app.SystemServiceRegistry;
|
||||
import android.app.admin.DevicePolicySafetyChecker;
|
||||
import android.app.usage.UsageStatsManagerInternal;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -2894,6 +2895,27 @@ public final class SystemServer implements Dumpable {
|
||||
t.traceEnd();
|
||||
}
|
||||
|
||||
if (isWatch) {
|
||||
t.traceBegin("StartWearService");
|
||||
String wearServiceComponentNameString =
|
||||
context.getString(R.string.config_wearServiceComponent);
|
||||
|
||||
if (!TextUtils.isEmpty(wearServiceComponentNameString)) {
|
||||
ComponentName wearServiceComponentName = ComponentName.unflattenFromString(
|
||||
wearServiceComponentNameString);
|
||||
|
||||
if (wearServiceComponentName != null) {
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(wearServiceComponentName);
|
||||
intent.addFlags(Intent.FLAG_DIRECT_BOOT_AUTO);
|
||||
context.startServiceAsUser(intent, UserHandle.SYSTEM);
|
||||
} else {
|
||||
Slog.d(TAG, "Null wear service component name.");
|
||||
}
|
||||
}
|
||||
t.traceEnd();
|
||||
}
|
||||
|
||||
// Enable airplane mode in safe mode. setAirplaneMode() cannot be called
|
||||
// earlier as it sends broadcasts to other services.
|
||||
// TODO: This may actually be too late if radio firmware already started leaking
|
||||
|
||||
Reference in New Issue
Block a user