• R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


Commit MetaInfo

修訂4af8f912aa1ee714638d0f9694d6f856bc8166f3 (tree)
時間2017-05-25 06:52:38
作者Dmitry Dementyev <dementyev@goog...>
Commiterandroid-build-team Robot

Log Message

resolve merge conflicts of 3964c51bf2 to nyc-dev

Bug: 33123882
Test: manual tests
Merged-In: If68343d155364654fa7db55ace3fb3c4db508c7e
Change-Id: I17ceca883819a161c4eab2a414abf0b64c320378
(cherry picked from commit 0f04a5a93f846d6f2d528ab6ae0c9e37d701e438)

Change Summary

差異

--- a/src/com/android/settings/accounts/ManageAccountsSettings.java
+++ b/src/com/android/settings/accounts/ManageAccountsSettings.java
@@ -36,6 +36,7 @@ import android.os.Bundle;
3636 import android.os.UserHandle;
3737 import android.support.v7.preference.Preference;
3838 import android.support.v7.preference.Preference.OnPreferenceClickListener;
39+import android.support.v7.preference.PreferenceGroup;
3940 import android.support.v7.preference.PreferenceScreen;
4041 import android.util.Log;
4142 import android.view.LayoutInflater;
@@ -83,7 +84,7 @@ public class ManageAccountsSettings extends AccountPreferenceBase
8384
8485 // If an account type is set, then show only accounts of that type
8586 private String mAccountType;
86- // Temporary hack, to deal with backward compatibility
87+ // Temporary hack, to deal with backward compatibility
8788 // mFirstAccount is used for the injected preferences
8889 private Account mFirstAccount;
8990
@@ -440,15 +441,18 @@ public class ManageAccountsSettings extends AccountPreferenceBase
440441 }
441442
442443 /**
443- * Filters through the preference list provided by GoogleLoginService.
444+ * Recursively filters through the preference list provided by GoogleLoginService.
444445 *
445446 * This method removes all the invalid intent from the list, adds account name as extra into the
446447 * intent, and hack the location settings to start it as a fragment.
447448 */
448- private void updatePreferenceIntents(PreferenceScreen prefs) {
449+ private void updatePreferenceIntents(PreferenceGroup prefs) {
449450 final PackageManager pm = getActivity().getPackageManager();
450451 for (int i = 0; i < prefs.getPreferenceCount();) {
451452 Preference pref = prefs.getPreference(i);
453+ if (pref instanceof PreferenceGroup) {
454+ updatePreferenceIntents((PreferenceGroup) pref);
455+ }
452456 Intent intent = pref.getIntent();
453457 if (intent != null) {
454458 // Hack. Launch "Location" as fragment instead of as activity.
@@ -497,8 +501,8 @@ public class ManageAccountsSettings extends AccountPreferenceBase
497501 } else {
498502 Log.e(TAG,
499503 "Refusing to launch authenticator intent because"
500- + "it exploits Settings permissions: "
501- + prefIntent);
504+ + " it exploits Settings permissions: "
505+ + prefIntent);
502506 }
503507 return true;
504508 }
@@ -518,20 +522,26 @@ public class ManageAccountsSettings extends AccountPreferenceBase
518522 private boolean isSafeIntent(PackageManager pm, Intent intent) {
519523 AuthenticatorDescription authDesc =
520524 mAuthenticatorHelper.getAccountTypeDescription(mAccountType);
521- ResolveInfo resolveInfo = pm.resolveActivity(intent, 0);
525+ ResolveInfo resolveInfo =
526+ pm.resolveActivityAsUser(intent, 0, mUserHandle.getIdentifier());
522527 if (resolveInfo == null) {
523528 return false;
524529 }
525530 ActivityInfo resolvedActivityInfo = resolveInfo.activityInfo;
526531 ApplicationInfo resolvedAppInfo = resolvedActivityInfo.applicationInfo;
527532 try {
533+ if (resolvedActivityInfo.exported) {
534+ if (resolvedActivityInfo.permission == null) {
535+ return true; // exported activity without permission.
536+ } else if (pm.checkPermission(resolvedActivityInfo.permission,
537+ authDesc.packageName) == PackageManager.PERMISSION_GRANTED) {
538+ return true;
539+ }
540+ }
528541 ApplicationInfo authenticatorAppInf = pm.getApplicationInfo(authDesc.packageName, 0);
529- return resolvedActivityInfo.exported
530- || resolvedAppInfo.uid == authenticatorAppInf.uid;
542+ return resolvedAppInfo.uid == authenticatorAppInf.uid;
531543 } catch (NameNotFoundException e) {
532- Log.e(TAG,
533- "Intent considered unsafe due to exception.",
534- e);
544+ Log.e(TAG, "Intent considered unsafe due to exception.", e);
535545 return false;
536546 }
537547 }