Merge "Show screen pinning toasts on all users" into lmp-mr1-dev
This commit is contained in:
@@ -235,6 +235,14 @@ public class Toast {
|
|||||||
public int getYOffset() {
|
public int getYOffset() {
|
||||||
return mTN.mY;
|
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.
|
* Make a standard toast that just contains a text view.
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.android.server.am;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@@ -56,8 +57,7 @@ public class LockTaskNotify {
|
|||||||
if (mLastToast != null) {
|
if (mLastToast != null) {
|
||||||
mLastToast.cancel();
|
mLastToast.cancel();
|
||||||
}
|
}
|
||||||
mLastToast = Toast.makeText(mContext, text, Toast.LENGTH_LONG);
|
mLastToast = makeAllUserToastAndShow(text);
|
||||||
mLastToast.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(boolean starting) {
|
public void show(boolean starting) {
|
||||||
@@ -65,7 +65,15 @@ public class LockTaskNotify {
|
|||||||
if (starting) {
|
if (starting) {
|
||||||
showString = R.string.lock_to_app_start;
|
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 {
|
private final class H extends Handler {
|
||||||
|
|||||||
Reference in New Issue
Block a user