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

Commit 467f9efe authored by Jason Monk's avatar Jason Monk Committed by Android Git Automerger
Browse files

am 104d2484: Merge "Show screen pinning toasts on all users" into lmp-mr1-dev

* commit '104d2484':
  Show screen pinning toasts on all users
parents 4e904890 104d2484
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -236,6 +236,14 @@ public class Toast {
        return mTN.mY;
    }

    /**
     * Gets the LayoutParams for the Toast window.
     * @hide
     */
    public WindowManager.LayoutParams getWindowParams() {
        return mTN.mParams;
    }
    
    /**
     * Make a standard toast that just contains a text view.
     *
+11 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.am;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import android.widget.Toast;

@@ -56,8 +57,7 @@ public class LockTaskNotify {
        if (mLastToast != null) {
            mLastToast.cancel();
        }
        mLastToast = Toast.makeText(mContext, text, Toast.LENGTH_LONG);
        mLastToast.show();
        mLastToast = makeAllUserToastAndShow(text);
    }

    public void show(boolean starting) {
@@ -65,7 +65,15 @@ public class LockTaskNotify {
        if (starting) {
            showString = R.string.lock_to_app_start;
        }
        Toast.makeText(mContext, mContext.getString(showString), Toast.LENGTH_LONG).show();
        makeAllUserToastAndShow(mContext.getString(showString));
    }

    private Toast makeAllUserToastAndShow(String text) {
        Toast toast = Toast.makeText(mContext, text, Toast.LENGTH_LONG);
        toast.getWindowParams().privateFlags |=
                WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
        toast.show();
        return toast;
    }

    private final class H extends Handler {