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

Commit 43f166df authored by Nancy Zheng's avatar Nancy Zheng
Browse files

Fix createConfirmDeviceCredentialIntent for wear for CTS.

Bug: 33000237
Change-Id: I1fdb5a518c41ab005f12d3142763e374b38d7553
parent 447fff85
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.RequiresPermission;
import android.app.trust.ITrustManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
import android.os.Binder;
import android.os.RemoteException;
@@ -44,6 +45,7 @@ public class KeyguardManager {
    private IWindowManager mWM;
    private ITrustManager mTrustManager;
    private IUserManager mUserManager;
    private Context mContext;

    /**
     * Intent used to prompt user for device credentials.
@@ -86,8 +88,12 @@ public class KeyguardManager {
        Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL);
        intent.putExtra(EXTRA_TITLE, title);
        intent.putExtra(EXTRA_DESCRIPTION, description);
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)) {
            intent.setPackage("com.google.android.apps.wearable.settings");
        } else {
            // For security reasons, only allow this to come from system settings.
            intent.setPackage("com.android.settings");
        }
        return intent;
    }

@@ -108,8 +114,12 @@ public class KeyguardManager {
        intent.putExtra(EXTRA_TITLE, title);
        intent.putExtra(EXTRA_DESCRIPTION, description);
        intent.putExtra(Intent.EXTRA_USER_ID, userId);
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)) {
            intent.setPackage("com.google.android.apps.wearable.settings");
        } else {
            // For security reasons, only allow this to come from system settings.
            intent.setPackage("com.android.settings");
        }
        return intent;
    }

@@ -191,7 +201,8 @@ public class KeyguardManager {
    }


    KeyguardManager() {
    KeyguardManager(Context context) {
        mContext = context;
        mWM = WindowManagerGlobal.getWindowManagerService();
        mTrustManager = ITrustManager.Stub.asInterface(
                ServiceManager.getService(Context.TRUST_SERVICE));
+3 −3
Original line number Diff line number Diff line
@@ -320,10 +320,10 @@ final class SystemServiceRegistry {
            }});

        registerService(Context.KEYGUARD_SERVICE, KeyguardManager.class,
                new StaticServiceFetcher<KeyguardManager>() {
                new CachedServiceFetcher<KeyguardManager>() {
            @Override
            public KeyguardManager createService() {
                return new KeyguardManager();
            public KeyguardManager createService(ContextImpl ctx) {
                return new KeyguardManager(ctx);
            }});

        registerService(Context.LAYOUT_INFLATER_SERVICE, LayoutInflater.class,