@@ -625,6 +625,11 @@ int doDump(Bundle* bundle)
625625 bool actImeService = false ;
626626 bool actWallpaperService = false ;
627627
628+ // These two implement the implicit permissions that are granted
629+ // to pre-1.6 applications.
630+ bool hasWriteExternalStoragePermission = false ;
631+ bool hasReadPhoneStatePermission = false ;
632+
628633 // This next group of variables is used to implement a group of
629634 // backward-compatibility heuristics necessitated by the addition of
630635 // some new uses-feature constants in 2.1 and 2.2. In most cases, the
@@ -986,6 +991,10 @@ int doDump(Bundle* bundle)
986991 name == " android.permission.WRITE_APN_SETTINGS" ||
987992 name == " android.permission.WRITE_SMS" ) {
988993 hasTelephonyPermission = true ;
994+ } else if (name == " android.permission.WRITE_EXTERNAL_STORAGE" ) {
995+ hasWriteExternalStoragePermission = true ;
996+ } else if (name == " android.permission.READ_PHONE_STATE" ) {
997+ hasReadPhoneStatePermission = true ;
989998 }
990999 printf (" uses-permission:'%s'\n " , name.string ());
9911000 } else {
@@ -1144,6 +1153,16 @@ int doDump(Bundle* bundle)
11441153 }
11451154 }
11461155
1156+ // Pre-1.6 implicitly granted permission compatibility logic
1157+ if (targetSdk < 4 ) {
1158+ if (!hasWriteExternalStoragePermission) {
1159+ printf (" uses-permission:'android.permission.WRITE_EXTERNAL_STORAGE'\n " );
1160+ }
1161+ if (!hasReadPhoneStatePermission) {
1162+ printf (" uses-permission:'android.permission.READ_PHONE_STATE'\n " );
1163+ }
1164+ }
1165+
11471166 /* The following blocks handle printing "inferred" uses-features, based
11481167 * on whether related features or permissions are used by the app.
11491168 * Note that the various spec*Feature variables denote whether the
0 commit comments