OSDN Git Service

Merge commit '12562abcd47de4aee3b0469cb04bf771c2072113' into manual_merge_12562abcd47d
authorNancy Zheng <nzheng@google.com>
Mon, 23 Jan 2017 22:04:19 +0000 (14:04 -0800)
committerNancy Zheng <nzheng@google.com>
Mon, 23 Jan 2017 22:06:38 +0000 (14:06 -0800)
Test: manually tested upstream

Change-Id: I8ca2eebcb468f73bf609ed09dc141a2bf40b8697

1  2 
core/java/android/app/KeyguardManager.java

@@@ -24,25 -22,19 +24,25 @@@ import android.app.trust.ITrustManager
  import android.content.Context;
  import android.content.Intent;
  import android.content.pm.PackageManager;
+ import android.content.pm.ResolveInfo;
  import android.os.Binder;
 -import android.os.IUserManager;
 +import android.os.Handler;
+ import android.os.IBinder;
- import android.os.PowerManager;
 +import android.os.Looper;
  import android.os.RemoteException;
- import android.os.IBinder;
- import android.os.IUserManager;
  import android.os.ServiceManager;
 +import android.os.ServiceManager.ServiceNotFoundException;
  import android.os.UserHandle;
- import android.view.IWindowManager;
 +import android.util.Log;
  import android.view.IOnKeyguardExitResult;
- import android.view.WindowManager;
+ import android.view.IWindowManager;
 +import android.view.WindowManager.LayoutParams;
  import android.view.WindowManagerGlobal;
  
 +import com.android.internal.policy.IKeyguardDismissCallback;
 +
+ import java.util.List;
  /**
   * Class that can be used to lock and unlock the keyboard. Get an instance of this
   * class by calling {@link android.content.Context#getSystemService(java.lang.String)}
@@@ -135,9 -119,19 +130,19 @@@ public class KeyguardManager 
          return intent;
      }
  
+     private String getSettingsPackageForIntent(Intent intent) {
+         List<ResolveInfo> resolveInfos = mContext.getPackageManager()
+                 .queryIntentActivities(intent, PackageManager.MATCH_SYSTEM_ONLY);
+         for (int i = 0; i < resolveInfos.size(); i++) {
+             return resolveInfos.get(i).activityInfo.packageName;
+         }
+         return "com.android.settings";
+     }
      /**
 -     * @deprecated Use {@link android.view.WindowManager.LayoutParams#FLAG_DISMISS_KEYGUARD}
 -     * and/or {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED}
 +     * @deprecated Use {@link LayoutParams#FLAG_DISMISS_KEYGUARD}
 +     * and/or {@link LayoutParams#FLAG_SHOW_WHEN_LOCKED}
       * instead; this allows you to seamlessly hide the keyguard as your application
       * moves in and out of the foreground and does not require that any special
       * permissions be requested.