FileDocCategorySizeDatePackage
ScreenPinningRequest.javaAPI DocAndroid 5.1 API11595Thu Mar 12 22:22:42 GMT 2015com.android.systemui.recent

ScreenPinningRequest

public class ScreenPinningRequest extends Object implements View.OnClickListener

Fields Summary
private final android.content.Context
mContext
private final android.view.accessibility.AccessibilityManager
mAccessibilityService
private final android.view.WindowManager
mWindowManager
private RequestWindowView
mRequestWindow
Constructors Summary
public ScreenPinningRequest(android.content.Context context)

        mContext = context;
        mAccessibilityService = (AccessibilityManager)
                mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
        mWindowManager = (WindowManager)
                mContext.getSystemService(Context.WINDOW_SERVICE);
    
Methods Summary
public voidclearPrompt()

        if (mRequestWindow != null) {
            mWindowManager.removeView(mRequestWindow);
            mRequestWindow = null;
        }
    
public FrameLayout.LayoutParamsgetRequestLayoutParams(boolean isLandscape)

        return new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT,
                isLandscape ? (Gravity.CENTER_VERTICAL | Gravity.RIGHT)
                            : (Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM));
    
private WindowManager.LayoutParamsgetWindowLayoutParams()

        final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT,
                WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
                0
                        | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                        | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                        | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
                ,
                PixelFormat.TRANSLUCENT);
        lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
        lp.setTitle("ScreenPinningConfirmation");
        lp.gravity = Gravity.FILL;
        return lp;
    
public voidonClick(android.view.View v)

        if (v.getId() == R.id.screen_pinning_ok_button || mRequestWindow == v) {
            try {
                ActivityManagerNative.getDefault().startLockTaskModeOnCurrent();
            } catch (RemoteException e) {}
        }
        clearPrompt();
    
public voidonConfigurationChanged()

        if (mRequestWindow != null) {
            mRequestWindow.onConfigurationChanged();
        }
    
public voidshowPrompt(boolean allowCancel)

        clearPrompt();

        mRequestWindow = new RequestWindowView(mContext, allowCancel);

        mRequestWindow.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);

        // show the confirmation
        WindowManager.LayoutParams lp = getWindowLayoutParams();
        mWindowManager.addView(mRequestWindow, lp);