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

Commit 96669b2b authored by Hall Liu's avatar Hall Liu Committed by Android (Google) Code Review
Browse files

Merge "Add command to reset car mode in Telecom" into sc-dev

parents e7db99e0 24a14c10
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
import android.Manifest;
import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.app.UiModeManager;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
@@ -1796,6 +1797,28 @@ public class TelecomServiceImpl {
            }
        }

        /**
         * A method intended for use in testing to reset car mode at all priorities.
         *
         * Runs during setup to avoid cascading failures from failing car mode CTS.
         */
        @Override
        public void resetCarMode() {
            Log.startSession("TCI.rCM");
            try {
                synchronized (mLock) {
                    enforceShellOnly(Binder.getCallingUid(), "resetCarMode");
                    Binder.withCleanCallingIdentity(() -> {
                        UiModeManager uiModeManager =
                                mContext.getSystemService(UiModeManager.class);
                        uiModeManager.disableCarMode(UiModeManager.DISABLE_CAR_MODE_ALL_PRIORITIES);
                    });
                }
            } finally {
                Log.endSession();
            }
        }

        @Override
        public void setTestDefaultCallRedirectionApp(String packageName) {
            try {