Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b1d9c69 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "DSU enhancement (5/N)" am: 0b0060a5

parents 17b69c28 0b0060a5
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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;

+20 −4
Original line number Diff line number Diff line
@@ -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) {