Disable immersive mode confirmation for custom lockscreen package

Change-Id: Iff92874727dbb0751aea1a48219acc5da6b64db7
issue-id: YAM-134
(cherry picked from commit 1bfeb70dad)
This commit is contained in:
Ed Mancebo
2016-02-17 13:52:52 -08:00
parent e80403fb3b
commit cfef128fbc

View File

@@ -43,6 +43,7 @@ import android.util.Log;
import android.view.IWindowManager; import android.view.IWindowManager;
import android.view.View; import android.view.View;
import android.view.WindowManagerGlobal; import android.view.WindowManagerGlobal;
import android.view.WindowManagerPolicyControl;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@@ -188,6 +189,7 @@ public class CyanogenSettingsPage extends SetupPage {
Log.i(TAG, "Applying default lockscreen"); Log.i(TAG, "Applying default lockscreen");
LockPatternUtils util = new LockPatternUtils(mContext); LockPatternUtils util = new LockPatternUtils(mContext);
util.setThirdPartyKeyguard(cn); util.setThirdPartyKeyguard(cn);
disableImmersivePromptForLockscreen(cn);
} catch (PackageManager.NameNotFoundException | SecurityException e) { } catch (PackageManager.NameNotFoundException | SecurityException e) {
Log.w(TAG, "Error setting default lockscreen: " + cn, e); Log.w(TAG, "Error setting default lockscreen: " + cn, e);
} }
@@ -195,6 +197,14 @@ public class CyanogenSettingsPage extends SetupPage {
} }
} }
private void disableImmersivePromptForLockscreen(ComponentName cn) {
// prevents the immersive screen hint for the lockscreen
WindowManagerPolicyControl policy = new WindowManagerPolicyControl();
policy.reloadFromSetting(mContext);
policy.addToPreconfirmWhiteList(cn.getPackageName());
policy.saveToSettings(mContext);
}
private static boolean hideKeyDisabler(Context ctx) { private static boolean hideKeyDisabler(Context ctx) {
final CMHardwareManager hardware = CMHardwareManager.getInstance(ctx); final CMHardwareManager hardware = CMHardwareManager.getInstance(ctx);
return !hardware.isSupported(CMHardwareManager.FEATURE_KEY_DISABLE); return !hardware.isSupported(CMHardwareManager.FEATURE_KEY_DISABLE);