FileDocCategorySizeDatePackage
LockTaskNotify.javaAPI DocAndroid 5.1 API3006Thu Mar 12 22:22:42 GMT 2015com.android.server.am

LockTaskNotify

public class LockTaskNotify extends Object
Helper to manage showing/hiding a image to notify them that they are entering or exiting lock-to-app mode.

Fields Summary
private static final String
TAG
private final android.content.Context
mContext
private final H
mHandler
private android.view.accessibility.AccessibilityManager
mAccessibilityManager
private android.widget.Toast
mLastToast
Constructors Summary
public LockTaskNotify(android.content.Context context)


       
        mContext = context;
        mAccessibilityManager = (AccessibilityManager)
                mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
        mHandler = new H();
    
Methods Summary
public voidhandleShowToast(boolean isLocked)

        String text = mContext.getString(isLocked
                ? R.string.lock_to_app_toast_locked : R.string.lock_to_app_toast);
        if (!isLocked && mAccessibilityManager.isEnabled()) {
            text = mContext.getString(R.string.lock_to_app_toast_accessible);
        }
        if (mLastToast != null) {
            mLastToast.cancel();
        }
        mLastToast = makeAllUserToastAndShow(text);
    
private android.widget.ToastmakeAllUserToastAndShow(java.lang.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;
    
public voidshow(boolean starting)

        int showString = R.string.lock_to_app_exit;
        if (starting) {
            showString = R.string.lock_to_app_start;
        }
        makeAllUserToastAndShow(mContext.getString(showString));
    
public voidshowToast(boolean isLocked)

        mHandler.obtainMessage(H.SHOW_TOAST, isLocked ? 1 : 0, 0 /* Not used */).sendToTarget();