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

Commit df539cb5 authored by Hall Liu's avatar Hall Liu Committed by Automerger Merge Worker
Browse files

Merge "Add command to reset car mode in Telecom" into sc-dev am: 96669b2b

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telecomm/+/13474659

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I408e588f2d0a5aac59b7954961396c4fb5084e46
parents d2b8cf94 96669b2b
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 {