Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2f33b12 authored by Himanshi Jain's avatar Himanshi Jain Committed by Android (Google) Code Review
Browse files

Merge "Add config_wearServiceComponent to start the WearService from system server."

parents 543deca1 71c8ea7d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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>

+1 −0
Original line number Diff line number Diff line
@@ -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" />
+22 −0
Original line number Diff line number Diff line
@@ -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