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

Commit 8e026957 authored by Chad Brubaker's avatar Chad Brubaker
Browse files

Fix unpacking of default IME package

Test: repro steps in 113270614
Change-Id: Ib1af0cc8d123b6ede6a02b93f32232e97a6c1cc1
Fixes: 113270614
parent 342df6dd
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.app.KeyguardManager;
import android.app.UriGrantsManager;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.ComponentName;
import android.content.ContentProvider;
import android.content.ContentResolver;
import android.content.Context;
@@ -48,6 +49,7 @@ import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Slog;
import android.util.SparseArray;

@@ -630,9 +632,12 @@ public class ClipboardService extends SystemService {
        // 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));
        if (defaultIme != null && defaultIme.equals(callingPackage)) {
        if (!TextUtils.isEmpty(defaultIme)) {
            final String imePkg = ComponentName.unflattenFromString(defaultIme).getPackageName();
            if (imePkg.equals(callingPackage)) {
                return true;
            }
        }

        // Otherwise only focused applications can access the clipboard.
        boolean uidFocused = mWm.isUidFocused(callingUid);