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

* commit '104d2484ec605d9673e74cc125d92d41b6968327':
  Show screen pinning toasts on all users
This commit is contained in:
Jason Monk
2014-10-24 14:00:25 +00:00
committed by Android Git Automerger
2 changed files with 19 additions and 3 deletions

View File

@@ -235,6 +235,14 @@ public class Toast {
public int getYOffset() {
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.

View File

@@ -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 {