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

Commit 0c002a29 authored by Bernardo Rufino's avatar Bernardo Rufino
Browse files

Suppress untrusted touches toast for Snapchat

We are aware of the issue (b/173297887) and working on a fix, however
the toast is annoying dogfooders and the app compat reset only lasts
during a reboot lifecycle.

Bug: 158002302
Bug: 173297887
Test: Open Snapchat, try to trigger toast, see logcat message and no
      toast.
Change-Id: I02e0473154f38531f67c686df9a01e7faed0ca98
parent c1b0c8bc
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.os.SomeArgs;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.XmlUtils;
import com.android.server.DisplayThread;
@@ -146,6 +147,16 @@ public class InputManagerService extends IInputManager.Stub

    private static final int DEFAULT_VIBRATION_MAGNITUDE = 192;

    /**
     * We know the issue and are working to fix it, so suppressing the toast to not annoy
     * dogfooders.
     *
     * TODO(b/169067926): Remove this
     */
    private static final String[] PACKAGE_BLOCKLIST_FOR_UNTRUSTED_TOUCHES_TOAST = {
            "com.snapchat.android" // b/173297887
    };

    // Pointer to native input manager service object.
    private final long mPtr;

@@ -2091,6 +2102,10 @@ public class InputManagerService extends IInputManager.Stub
    // Native callback
    private void notifyUntrustedTouch(String packageName) {
        // TODO(b/169067926): Remove toast after gathering feedback on dogfood.
        if (ArrayUtils.contains(PACKAGE_BLOCKLIST_FOR_UNTRUSTED_TOUCHES_TOAST, packageName)) {
            Log.i(TAG, "Suppressing untrusted touch toast for " + packageName);
            return;
        }
        DisplayThread.getHandler().post(() ->
                Toast.makeText(mContext,
                        "Touch obscured by " + packageName