Merge "DSU enhancement (5/N)" am: 0b0060a550
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2532664 Change-Id: I055be8417afa33d5b96323bc96a1b84a96ebd786 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -238,6 +238,15 @@ public class DynamicSystemClient {
|
||||
*/
|
||||
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 final WeakReference<DynamicSystemClient> mWeakClient;
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.dynsystem;
|
||||
|
||||
import static android.os.image.DynamicSystemClient.KEY_KEYGUARD_USE_DEFAULT_STRINGS;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.Context;
|
||||
@@ -47,10 +49,7 @@ public class VerificationActivity extends Activity {
|
||||
KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||
|
||||
if (km != null) {
|
||||
String title = getString(R.string.keyguard_title);
|
||||
String description = getString(R.string.keyguard_description);
|
||||
Intent intent = km.createConfirmDeviceCredentialIntent(title, description);
|
||||
|
||||
Intent intent = createConfirmDeviceCredentialIntent(km);
|
||||
if (intent == null) {
|
||||
Log.d(TAG, "This device is not protected by a password/pin");
|
||||
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
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
|
||||
|
||||
Reference in New Issue
Block a user