Skip to content

Commit 52c6234

Browse files
author
Dianne Hackborn
committed
Fix issue #7213113: Remove old intent resolver
Also make the query package restart broadcast protected like the documentation says it should be. Change-Id: I445166111318a02f2f2b1ab0dff9c641a441c20b
1 parent 6de76d2 commit 52c6234

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

core/java/android/widget/AppSecurityPermissions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public AppSecurityPermissions(Context context, String packageName) {
257257
try {
258258
pkgInfo = mPm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS);
259259
} catch (NameNotFoundException e) {
260-
Log.w(TAG, "Could'nt retrieve permissions for package:"+packageName);
260+
Log.w(TAG, "Couldn't retrieve permissions for package:"+packageName);
261261
return;
262262
}
263263
// Extract all user permissions

core/res/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<protected-broadcast android:name="android.intent.action.PACKAGE_NEEDS_VERIFICATION" />
4646
<protected-broadcast android:name="android.intent.action.PACKAGE_VERIFIED" />
4747
<protected-broadcast android:name="android.intent.action.UID_REMOVED" />
48+
<protected-broadcast android:name="android.intent.action.QUERY_PACKAGE_RESTART" />
4849
<protected-broadcast android:name="android.intent.action.CONFIGURATION_CHANGED" />
4950
<protected-broadcast android:name="android.intent.action.LOCALE_CHANGED" />
5051
<protected-broadcast android:name="android.intent.action.BATTERY_CHANGED" />

core/res/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3141,7 +3141,7 @@
31413141

31423142
<!-- Security Permissions strings-->
31433143
<!-- Text that is placed at the front of a permission name that is being added to an app [CHAR LIMIT=NONE] -->
3144-
<string name="perms_new_perm_prefix"><font size="12" fgcolor="#ff900000">NEW: </font></string>
3144+
<string name="perms_new_perm_prefix"><font size="12" fgcolor="#ff33b5e5">NEW: </font></string>
31453145
<!-- Text that is placed at the front of a permission name that is being added to an app [CHAR LIMIT=NONE] -->
31463146
<string name="perms_description_app">Provided by <xliff:g id="app_name">%1$s</xliff:g>.</string>
31473147
<!-- Shown for an application when it doesn't require any permission grants. -->

services/java/com/android/server/IntentResolver.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public abstract class IntentResolver<F extends IntentFilter, R extends Object> {
4646
final private static String TAG = "IntentResolver";
4747
final private static boolean DEBUG = false;
4848
final private static boolean localLOGV = DEBUG || false;
49+
final private static boolean VALIDATE = false;
4950

5051
public void addFilter(F f) {
5152
if (localLOGV) {
@@ -67,16 +68,20 @@ public void addFilter(F f) {
6768
mTypedActionToFilter, " TypedAction: ");
6869
}
6970

70-
mOldResolver.addFilter(f);
71-
verifyDataStructures(f);
71+
if (VALIDATE) {
72+
mOldResolver.addFilter(f);
73+
verifyDataStructures(f);
74+
}
7275
}
7376

7477
public void removeFilter(F f) {
7578
removeFilterInternal(f);
7679
mFilters.remove(f);
7780

78-
mOldResolver.removeFilter(f);
79-
verifyDataStructures(f);
81+
if (VALIDATE) {
82+
mOldResolver.removeFilter(f);
83+
verifyDataStructures(f);
84+
}
8085
}
8186

8287
void removeFilterInternal(F f) {
@@ -314,12 +319,14 @@ public List<R> queryIntent(Intent intent, String resolvedType, boolean defaultOn
314319
}
315320
sortResults(finalList);
316321

317-
List<R> oldList = mOldResolver.queryIntent(intent, resolvedType, defaultOnly, userId);
318-
if (oldList.size() != finalList.size()) {
319-
ValidationFailure here = new ValidationFailure();
320-
here.fillInStackTrace();
321-
Log.wtf(TAG, "Query result " + intent + " size is " + finalList.size()
322-
+ "; old implementation is " + oldList.size(), here);
322+
if (VALIDATE) {
323+
List<R> oldList = mOldResolver.queryIntent(intent, resolvedType, defaultOnly, userId);
324+
if (oldList.size() != finalList.size()) {
325+
ValidationFailure here = new ValidationFailure();
326+
here.fillInStackTrace();
327+
Log.wtf(TAG, "Query result " + intent + " size is " + finalList.size()
328+
+ "; old implementation is " + oldList.size(), here);
329+
}
323330
}
324331

325332
if (debug) {

0 commit comments

Comments
 (0)