private void setupListener() { ContentResolver resolver = mContext.getContentResolver(); mPieTriggerSlots = Settings.System.getIntForUser( resolver, Settings.System.PIE_GRAVITY, EdgeGesturePosition.LEFT.FLAG, UserHandle.USER_CURRENT); int sensitivity = mContext.getResources().getInteger(R.integer.pie_gesture_sensivity); if (sensitivity < EdgeServiceConstants.SENSITIVITY_LOWEST || sensitivity > EdgeServiceConstants.SENSITIVITY_HIGHEST) { sensitivity = EdgeServiceConstants.SENSITIVITY_DEFAULT; } int flags = mPieTriggerSlots & mPieTriggerMask; if (Settings.System.getIntForUser( resolver, Settings.System.PIE_IME_CONTROL, 1, UserHandle.USER_CURRENT) == 1) { flags |= EdgeServiceConstants.IME_CONTROL; } mPieManager.updateEdgeGestureActivationListener( mPieActivationListener, sensitivity << EdgeServiceConstants.SENSITIVITY_SHIFT | flags); }
public PieController( Context context, BaseStatusBar statusBar, EdgeGestureManager pieManager, NavigationBarOverlay nbo) { mContext = context; mStatusBar = statusBar; mNavigationBarOverlay = nbo; mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); mWm = IWindowManager.Stub.asInterface(ServiceManager.getService("window")); if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); } mPieManager = pieManager; mPieManager.setEdgeGestureActivationListener(mPieActivationListener); }
public void detachContainer(boolean onExit) { if (mPieContainer == null || !mAttached) { return; } if (isShowing() && !onExit) { mIsDetaching = true; return; } mIsDetaching = false; mAttached = false; mPieManager.updateEdgeGestureActivationListener(mPieActivationListener, 0); if (mTelephonyManager != null) { mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); } mContext.getContentResolver().unregisterContentObserver(mSettingsObserver); mContext.unregisterReceiver(mBroadcastReceiver); mPieContainer.clearSlices(); mPieContainer = null; }