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

Commit 7891b6a9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow Shell to access the clipboard"

parents 2bbdc1bb bd175fe8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4147,6 +4147,11 @@
    <permission android:name="android.permission.BIND_SMS_APP_SERVICE"
        android:protectionLevel="signature" />

    <!-- @hide Permission that allows background clipboard access.
         <p>Not for use by third-party applications. -->
    <permission android:name="android.permission.READ_CLIPBOARD_IN_BACKGROUND"
        android:protectionLevel="signature" />

    <application android:process="system"
                 android:persistent="true"
                 android:hasCode="false"
+1 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@

    <uses-permission android:name="android.permission.CONTROL_KEYGUARD" />
    <uses-permission android:name="android.permission.SUSPEND_APPS" />
    <uses-permission android:name="android.permission.READ_CLIPBOARD_IN_BACKGROUND" />

    <application android:label="@string/app_label"
                 android:defaultToDeviceProtectedStorage="true"
+5 −0
Original line number Diff line number Diff line
@@ -629,6 +629,11 @@ public class ClipboardService extends SystemService {
        if (mAppOps.noteOp(op, callingUid, callingPackage) != AppOpsManager.MODE_ALLOWED) {
            return false;
        }
        // Shell can access the clipboard for testing purposes.
        if (mPm.checkPermission(android.Manifest.permission.READ_CLIPBOARD_IN_BACKGROUND,
                    callingPackage) == PackageManager.PERMISSION_GRANTED) {
            return true;
        }
        // The default IME is always allowed to access the clipboard.
        String defaultIme = Settings.Secure.getStringForUser(getContext().getContentResolver(),
                Settings.Secure.DEFAULT_INPUT_METHOD, UserHandle.getUserId(callingUid));