Merge "DSU enhancement (5/N)"
This commit is contained in:
@@ -238,6 +238,15 @@ public class DynamicSystemClient {
|
|||||||
*/
|
*/
|
||||||
public static final String KEY_ONE_SHOT = "KEY_ONE_SHOT";
|
public static final String KEY_ONE_SHOT = "KEY_ONE_SHOT";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intent key: Whether to use default strings when showing the dialog that prompts
|
||||||
|
* user for device credentials.
|
||||||
|
* False indicates using the custom strings provided by {@code DynamicSystem}.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String KEY_KEYGUARD_USE_DEFAULT_STRINGS =
|
||||||
|
"KEY_KEYGUARD_USE_DEFAULT_STRINGS";
|
||||||
|
|
||||||
private static class IncomingHandler extends Handler {
|
private static class IncomingHandler extends Handler {
|
||||||
private final WeakReference<DynamicSystemClient> mWeakClient;
|
private final WeakReference<DynamicSystemClient> mWeakClient;
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.dynsystem;
|
package com.android.dynsystem;
|
||||||
|
|
||||||
|
import static android.os.image.DynamicSystemClient.KEY_KEYGUARD_USE_DEFAULT_STRINGS;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -47,10 +49,7 @@ public class VerificationActivity extends Activity {
|
|||||||
KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||||
|
|
||||||
if (km != null) {
|
if (km != null) {
|
||||||
String title = getString(R.string.keyguard_title);
|
Intent intent = createConfirmDeviceCredentialIntent(km);
|
||||||
String description = getString(R.string.keyguard_description);
|
|
||||||
Intent intent = km.createConfirmDeviceCredentialIntent(title, description);
|
|
||||||
|
|
||||||
if (intent == null) {
|
if (intent == null) {
|
||||||
Log.d(TAG, "This device is not protected by a password/pin");
|
Log.d(TAG, "This device is not protected by a password/pin");
|
||||||
startInstallationService();
|
startInstallationService();
|
||||||
@@ -63,6 +62,23 @@ public class VerificationActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Intent createConfirmDeviceCredentialIntent(KeyguardManager km) {
|
||||||
|
final boolean useDefaultStrings =
|
||||||
|
getIntent().getBooleanExtra(KEY_KEYGUARD_USE_DEFAULT_STRINGS, false);
|
||||||
|
final String title;
|
||||||
|
final String description;
|
||||||
|
if (useDefaultStrings) {
|
||||||
|
// Use default strings provided by keyguard manager
|
||||||
|
title = null;
|
||||||
|
description = null;
|
||||||
|
} else {
|
||||||
|
// Use custom strings provided by DSU
|
||||||
|
title = getString(R.string.keyguard_title);
|
||||||
|
description = getString(R.string.keyguard_description);
|
||||||
|
}
|
||||||
|
return km.createConfirmDeviceCredentialIntent(title, description);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
|
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
|
||||||
|
|||||||
Reference in New Issue
Block a user