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

Commit f0f06063 authored by Rene Mayrhofer's avatar Rene Mayrhofer Committed by Gerrit Code Review
Browse files

Merge changes from topic "EnableAirplaneModeInSafeMode"

* changes:
  Add import of android.provider.Settings
  Enable airplane mode when booting in safe mode
parents 56401a4c 40c11968
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {

                Slog.d(TAG,
                        "Airplane Mode change - current state:  " + BluetoothAdapter.nameForState(
                                st));
                                st) + ", isAirplaneModeOn()=" + isAirplaneModeOn());

                if (isAirplaneModeOn()) {
                    // Clear registered LE apps to force shut-off
+27 −3
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.os.storage.IStorageManager;
import android.provider.Settings;
import android.sysprop.VoldProperties;
import android.util.DisplayMetrics;
import android.util.EventLog;
@@ -966,6 +967,18 @@ public final class SystemServer {
            Slog.e("System", "************ Failure starting core service", e);
        }

        // Before things start rolling, be sure we have decided whether
        // we are in safe mode.
        final boolean safeMode = wm.detectSafeMode();
        if (safeMode) {
            // If yes, immediately turn on the global setting for airplane mode.
            // Note that this does not send broadcasts at this stage because
            // subsystems are not yet up. We will send broadcasts later to ensure
            // all listeners have the chance to react with special handling.
            Settings.Global.putInt(context.getContentResolver(),
                    Settings.Global.AIRPLANE_MODE_ON, 1);
        }

        StatusBarManagerService statusBar = null;
        INotificationManager notification = null;
        LocationManagerService location = null;
@@ -1672,9 +1685,6 @@ public final class SystemServer {
        mSystemServiceManager.startService(StatsCompanionService.Lifecycle.class);
        traceEnd();

        // Before things start rolling, be sure we have decided whether
        // we are in safe mode.
        final boolean safeMode = wm.detectSafeMode();
        if (safeMode) {
            traceBeginAndSlog("EnterSafeModeAndDisableJitCompilation");
            mActivityManagerService.enterSafeMode();
@@ -1862,6 +1872,20 @@ public final class SystemServer {
                reportWtf("starting System UI", e);
            }
            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
            // RF before the respective services start. However, fixing this requires changes
            // to radio firmware and interfaces.
            if (safeMode) {
                traceBeginAndSlog("EnableAirplaneModeInSafeMode");
                try {
                    connectivityF.setAirplaneMode(true);
                } catch (Throwable e) {
                    reportWtf("enabling Airplane Mode during Safe Mode bootup", e);
                }
                traceEnd();
            }
            traceBeginAndSlog("MakeNetworkManagementServiceReady");
            try {
                if (networkManagementF != null) networkManagementF.systemReady();