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

Commit 2a12d852 authored by Nancy Zheng's avatar Nancy Zheng Committed by android-build-merger
Browse files

Fix createConfirmDeviceCredentialIntent for wear for CTS. am: 43f166df

am: a2193c0b

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


    /**
    /**
     * Intent used to prompt user for device credentials.
     * Intent used to prompt user for device credentials.
@@ -86,8 +88,12 @@ public class KeyguardManager {
        Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL);
        Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL);
        intent.putExtra(EXTRA_TITLE, title);
        intent.putExtra(EXTRA_TITLE, title);
        intent.putExtra(EXTRA_DESCRIPTION, description);
        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.
            // For security reasons, only allow this to come from system settings.
            intent.setPackage("com.android.settings");
            intent.setPackage("com.android.settings");
        }
        return intent;
        return intent;
    }
    }


@@ -108,8 +114,12 @@ public class KeyguardManager {
        intent.putExtra(EXTRA_TITLE, title);
        intent.putExtra(EXTRA_TITLE, title);
        intent.putExtra(EXTRA_DESCRIPTION, description);
        intent.putExtra(EXTRA_DESCRIPTION, description);
        intent.putExtra(Intent.EXTRA_USER_ID, userId);
        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.
            // For security reasons, only allow this to come from system settings.
            intent.setPackage("com.android.settings");
            intent.setPackage("com.android.settings");
        }
        return intent;
        return intent;
    }
    }


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




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


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


        registerService(Context.LAYOUT_INFLATER_SERVICE, LayoutInflater.class,
        registerService(Context.LAYOUT_INFLATER_SERVICE, LayoutInflater.class,