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

Commit 9a2c2b1c authored by Oli Lan's avatar Oli Lan Committed by Android (Google) Code Review
Browse files

Merge "Clear calling identity before retrieving app label for clipboard toast." into sc-dev

parents ad89c405 fddbb49c
Loading
Loading
Loading
Loading
+28 −26
Original line number Diff line number Diff line
@@ -950,6 +950,7 @@ public class ClipboardService extends SystemService {
        }
        clipboard.mNotifiedUids.put(uid, true);

        Binder.withCleanCallingIdentity(() -> {
            // Retrieve the app label of the source of the clip data
            CharSequence sourceAppLabel = null;
            if (clipboard.mPrimaryClipPackage != null) {
@@ -969,15 +970,16 @@ public class ClipboardService extends SystemService {
                    message = getContext().getString(
                            R.string.pasted_from_app, callingAppLabel, sourceAppLabel);
                } else {
                message = getContext().getString(R.string.pasted_from_clipboard, callingAppLabel);
                    message = getContext().getString(
                            R.string.pasted_from_clipboard, callingAppLabel);
                }
                Slog.i(TAG, message);
            Binder.withCleanCallingIdentity(() ->
                    Toast.makeText(getContext(), UiThread.get().getLooper(), message,
                            Toast.LENGTH_SHORT)
                            .show());
                Toast.makeText(
                        getContext(), UiThread.get().getLooper(), message, Toast.LENGTH_SHORT)
                        .show();
            } catch (PackageManager.NameNotFoundException e) {
                // do nothing
            }
        });
    }
}