Add hook to set custom default lock screen on setup
issue-id: YAM-115 Change-Id: I8c6df704c96523fadff16c8c586ebbb91a8c1c32
This commit is contained in:
@@ -50,6 +50,7 @@
|
|||||||
<uses-permission android:name="com.cyanogen.permission.REQUEST_KILL_SWITCH_OP" />
|
<uses-permission android:name="com.cyanogen.permission.REQUEST_KILL_SWITCH_OP" />
|
||||||
<uses-permission android:name="cyanogenmod.permission.WRITE_SETTINGS"/>
|
<uses-permission android:name="cyanogenmod.permission.WRITE_SETTINGS"/>
|
||||||
<uses-permission android:name="cyanogenmod.permission.WRITE_SECURE_SETTINGS"/>
|
<uses-permission android:name="cyanogenmod.permission.WRITE_SECURE_SETTINGS"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE" />
|
||||||
|
|
||||||
<permission
|
<permission
|
||||||
android:name="cyanogenmod.permission.PROTECTED_APP"
|
android:name="cyanogenmod.permission.PROTECTED_APP"
|
||||||
|
|||||||
@@ -21,4 +21,5 @@
|
|||||||
0=default sim image, 1=sim on side, 2=sim on back-->
|
0=default sim image, 1=sim on side, 2=sim on back-->
|
||||||
<integer name="sim_image_type">0</integer>
|
<integer name="sim_image_type">0</integer>
|
||||||
<bool name="check_custom_theme_by_default">true</bool>
|
<bool name="check_custom_theme_by_default">true</bool>
|
||||||
|
<string name="default_custom_lockscreen_component"></string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import android.text.Spannable;
|
|||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.text.style.ClickableSpan;
|
import android.text.style.ClickableSpan;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -46,6 +47,8 @@ import android.widget.CheckBox;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
|
|
||||||
import com.cyanogenmod.setupwizard.R;
|
import com.cyanogenmod.setupwizard.R;
|
||||||
import com.cyanogenmod.setupwizard.SetupWizardApp;
|
import com.cyanogenmod.setupwizard.SetupWizardApp;
|
||||||
import com.cyanogenmod.setupwizard.cmstats.SetupStats;
|
import com.cyanogenmod.setupwizard.cmstats.SetupStats;
|
||||||
@@ -146,6 +149,7 @@ public class CyanogenSettingsPage extends SetupPage {
|
|||||||
});
|
});
|
||||||
handleEnableMetrics();
|
handleEnableMetrics();
|
||||||
handleDefaultThemeSetup();
|
handleDefaultThemeSetup();
|
||||||
|
handleDefaultLockscreenSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleEnableMetrics() {
|
private void handleEnableMetrics() {
|
||||||
@@ -175,6 +179,24 @@ public class CyanogenSettingsPage extends SetupPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleDefaultLockscreenSetup() {
|
||||||
|
String defaultLockscreenComponent = mContext.getResources().getString(
|
||||||
|
R.string.default_custom_lockscreen_component);
|
||||||
|
if (!TextUtils.isEmpty(defaultLockscreenComponent)) {
|
||||||
|
ComponentName cn =
|
||||||
|
ComponentName.unflattenFromString(defaultLockscreenComponent);
|
||||||
|
if (cn != null) {
|
||||||
|
try {
|
||||||
|
Log.i(TAG, "Applying default lockscreen");
|
||||||
|
LockPatternUtils util = new LockPatternUtils(mContext);
|
||||||
|
util.setThirdPartyKeyguard(cn);
|
||||||
|
} catch (PackageManager.NameNotFoundException | SecurityException e) {
|
||||||
|
Log.w(TAG, "Error setting default lockscreen: " + cn, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user