summaryrefslogtreecommitdiff
path: root/services/java
diff options
context:
space:
mode:
authorrepo sync -c -j48 <himanshijn@google.com>2023-02-01 14:34:18 +0000
committerHimanshi Jain <himanshijn@google.com>2023-02-03 22:49:23 +0000
commit71c8ea7da69f6593d9296f0a38453f10c9963a10 (patch)
treeb71180730850bcabe22522f82bf6b9e5720a3c37 /services/java
parent0e8ed8561221f22d66e5a1a4f8424618e4609b29 (diff)
downloadbase-71c8ea7da69f6593d9296f0a38453f10c9963a10.tar.gz
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
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/SystemServer.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index d22be9ec01d0..5c6cc9f6ecaa 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -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