Merge changes from topic "Remove telephony protection level" into rvc-dev am: 0ed16d7b4b

Change-Id: If4e18fe057a500863cbd62db7bcd68be05bd0d6d
This commit is contained in:
Amit Mahajan
2020-03-18 19:42:35 +00:00
committed by Automerger Merge Worker
14 changed files with 17 additions and 97 deletions

View File

@@ -2310,7 +2310,6 @@ package android.content.pm {
field public static final int PROTECTION_FLAG_OEM = 16384; // 0x4000
field public static final int PROTECTION_FLAG_RETAIL_DEMO = 16777216; // 0x1000000
field public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 65536; // 0x10000
field public static final int PROTECTION_FLAG_TELEPHONY = 4194304; // 0x400000
field public static final int PROTECTION_FLAG_WELLBEING = 131072; // 0x20000
field @Nullable public final String backgroundPermission;
field @StringRes public int requestRes;

View File

@@ -964,7 +964,6 @@ package android.content.pm {
method @NonNull public abstract String getServicesSystemSharedLibraryPackageName();
method @NonNull public abstract String getSharedSystemSharedLibraryPackageName();
method @Nullable public String getSystemTextClassifierPackageName();
method @Nullable public String[] getTelephonyPackageNames();
method @Nullable public String getWellbeingPackageName();
method @RequiresPermission("android.permission.GRANT_RUNTIME_PERMISSIONS") public abstract void grantRuntimePermission(@NonNull String, @NonNull String, @NonNull android.os.UserHandle);
method @RequiresPermission("android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS") public abstract void removeOnPermissionsChangeListener(@NonNull android.content.pm.PackageManager.OnPermissionsChangedListener);
@@ -1007,7 +1006,6 @@ package android.content.pm {
field public static final int PROTECTION_FLAG_OEM = 16384; // 0x4000
field public static final int PROTECTION_FLAG_RETAIL_DEMO = 16777216; // 0x1000000
field public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 65536; // 0x10000
field public static final int PROTECTION_FLAG_TELEPHONY = 4194304; // 0x400000
field public static final int PROTECTION_FLAG_VENDOR_PRIVILEGED = 32768; // 0x8000
field public static final int PROTECTION_FLAG_WELLBEING = 131072; // 0x20000
field @Nullable public final String backgroundPermission;

View File

@@ -3296,15 +3296,6 @@ public class ApplicationPackageManager extends PackageManager {
}
}
@Override
public String[] getTelephonyPackageNames() {
try {
return mPM.getTelephonyPackageNames();
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
}
@Override
public String getSystemCaptionsServicePackageName() {
try {

View File

@@ -680,8 +680,6 @@ interface IPackageManager {
String getWellbeingPackageName();
String[] getTelephonyPackageNames();
String getAppPredictionServicePackageName();
String getSystemCaptionsServicePackageName();

View File

@@ -7795,18 +7795,6 @@ public abstract class PackageManager {
"getAppPredictionServicePackageName not implemented in subclass");
}
/**
* @return the system defined telephony package names, or null if there's none.
*
* @hide
*/
@Nullable
@TestApi
public String[] getTelephonyPackageNames() {
throw new UnsupportedOperationException(
"getTelephonyPackageNames not implemented in subclass");
}
/**
* @return the system defined content capture service package name, or null if there's none.
*

View File

@@ -237,17 +237,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
@TestApi
public static final int PROTECTION_FLAG_APP_PREDICTOR = 0x200000;
/**
* Additional flag for {@link #protectionLevel}, corresponding
* to the <code>telephony</code> value of
* {@link android.R.attr#protectionLevel}.
*
* @hide
*/
@SystemApi
@TestApi
public static final int PROTECTION_FLAG_TELEPHONY = 0x400000;
/**
* Additional flag for {@link #protectionLevel}, corresponding
* to the <code>companion</code> value of
@@ -291,7 +280,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
PROTECTION_FLAG_CONFIGURATOR,
PROTECTION_FLAG_INCIDENT_REPORT_APPROVER,
PROTECTION_FLAG_APP_PREDICTOR,
PROTECTION_FLAG_TELEPHONY,
PROTECTION_FLAG_COMPANION,
PROTECTION_FLAG_RETAIL_DEMO,
})
@@ -537,9 +525,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
if ((level & PermissionInfo.PROTECTION_FLAG_APP_PREDICTOR) != 0) {
protLevel += "|appPredictor";
}
if ((level & PermissionInfo.PROTECTION_FLAG_TELEPHONY) != 0) {
protLevel += "|telephony";
}
if ((level & PermissionInfo.PROTECTION_FLAG_RETAIL_DEMO) != 0) {
protLevel += "|retailDemo";
}

View File

@@ -737,7 +737,7 @@
<!-- @SystemApi Allows accessing the messages on ICC
@hide Used internally. -->
<permission android:name="android.permission.ACCESS_MESSAGES_ON_ICC"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- Used for runtime permissions related to user's SMS messages. -->
<permission-group android:name="android.permission-group.SMS"
@@ -1698,7 +1698,7 @@
@hide This should only be used by Settings and SystemUI.
-->
<permission android:name="android.permission.NETWORK_SETTINGS"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- Allows holder to request bluetooth/wifi scan bypassing global "use location" setting and
location permissions.
@@ -2139,7 +2139,7 @@
<!-- @SystemApi Allows granting runtime permissions to telephony related components.
@hide -->
<permission android:name="android.permission.GRANT_RUNTIME_PERMISSIONS_TO_TELEPHONY_DEFAULTS"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- Allows modification of the telephony state - power on, mmi, etc.
Does not include placing calls.
@@ -2167,7 +2167,7 @@
<!-- @SystemApi Allows listen permission to always reported signal strength.
@hide Used internally. -->
<permission android:name="android.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- @SystemApi Protects the ability to register any PhoneAccount with
PhoneAccount#CAPABILITY_SIM_SUBSCRIPTION. This capability indicates that the PhoneAccount
@@ -2280,12 +2280,12 @@
<!-- Must be required by a telephony data service to ensure that only the
system can bind to it.
<p>Protection level: signature|telephony
<p>Protection level: signature
@SystemApi
@hide
-->
<permission android:name="android.permission.BIND_TELEPHONY_DATA_SERVICE"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- Must be required by a NetworkService to ensure that only the
system can bind to it.
@@ -2306,19 +2306,19 @@
<!-- @SystemApi Must be required by an EuiccService to ensure that only the system can bind to
it.
<p>Protection level: signature|telephony
<p>Protection level: signature
@hide
-->
<permission android:name="android.permission.BIND_EUICC_SERVICE"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- Required for reading information about carrier apps from SystemConfigManager.
<p>Protection level: signature|telephony
<p>Protection level: signature
@SystemApi
@hide
-->
<permission android:name="android.permission.READ_CARRIER_APP_INFO"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- ================================== -->
<!-- Permissions for sdcard interaction -->
@@ -2676,7 +2676,7 @@
@hide
-->
<permission android:name="android.permission.SUGGEST_TELEPHONY_TIME_AND_ZONE"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- Allows applications like settings to suggest the user's manually chosen time / time zone.
<p>Not for use by third-party applications.
@@ -3156,7 +3156,7 @@
@hide
-->
<permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- @SystemApi Allows an application to use
{@link android.view.WindowManager.LayoutsParams#SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS}
@@ -4014,7 +4014,7 @@
@hide
-->
<permission android:name="android.permission.DEVICE_POWER"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- Allows toggling battery saver on the system.
Superseded by DEVICE_POWER permission. @hide @SystemApi
@@ -4049,13 +4049,13 @@
<p>Not for use by third-party applications.
-->
<permission android:name="android.permission.BROADCAST_SMS"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- Allows an application to broadcast a WAP PUSH receipt notification.
<p>Not for use by third-party applications.
-->
<permission android:name="android.permission.BROADCAST_WAP_PUSH"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- @SystemApi Allows an application to broadcast privileged networking requests.
<p>Not for use by third-party applications.
@@ -4721,13 +4721,13 @@
{@link android.provider.BlockedNumberContract}.
@hide -->
<permission android:name="android.permission.READ_BLOCKED_NUMBERS"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- Allows the holder to write blocked numbers. See
{@link android.provider.BlockedNumberContract}.
@hide -->
<permission android:name="android.permission.WRITE_BLOCKED_NUMBERS"
android:protectionLevel="signature|telephony" />
android:protectionLevel="signature" />
<!-- Must be required by an {@link android.service.vr.VrListenerService}, to ensure that only
the system can bind to it.

View File

@@ -295,9 +295,6 @@
<!-- Additional flag from base permission type: this permission can be automatically
granted to the system app predictor -->
<flag name="appPredictor" value="0x200000" />
<!-- Additional flag from base permission type: this permission can be automatically
granted to the system telephony apps -->
<flag name="telephony" value="0x400000" />
<!-- Additional flag from base permission type: this permission can be automatically
granted to the system companion device manager service -->
<flag name="companion" value="0x800000" />

View File

@@ -3641,15 +3641,6 @@
-->
<string name="config_defaultWellbeingPackage" translatable="false"></string>
<!-- The package name for the system telephony apps.
This package must be trusted, as it will be granted with permissions with special telephony
protection level. Note, framework by default support multiple telephony apps, each package
name is separated by comma.
Example: "com.android.phone,com.android.stk,com.android.providers.telephony"
(Note: shell is included for testing purposes)
-->
<string name="config_telephonyPackages" translatable="false">"com.android.phone,com.android.stk,com.android.providers.telephony,com.android.ons"</string>
<!-- The component name for the default system attention service.
This service must be trusted, as it can be activated without explicit consent of the user.
See android.attention.AttentionManagerService.

View File

@@ -3398,7 +3398,6 @@
<java-symbol type="string" name="config_defaultAutofillService" />
<java-symbol type="string" name="config_defaultTextClassifierPackage" />
<java-symbol type="string" name="config_defaultWellbeingPackage" />
<java-symbol type="string" name="config_telephonyPackages" />
<java-symbol type="string" name="config_defaultContentCaptureService" />
<java-symbol type="string" name="config_defaultAugmentedAutofillService" />
<java-symbol type="string" name="config_defaultAppPredictionService" />

View File

@@ -66,7 +66,6 @@ public abstract class PackageManagerInternal {
public static final int PACKAGE_CONFIGURATOR = 9;
public static final int PACKAGE_INCIDENT_REPORT_APPROVER = 10;
public static final int PACKAGE_APP_PREDICTOR = 11;
public static final int PACKAGE_TELEPHONY = 12;
public static final int PACKAGE_WIFI = 13;
public static final int PACKAGE_COMPANION = 14;
public static final int PACKAGE_RETAIL_DEMO = 15;
@@ -124,7 +123,6 @@ public abstract class PackageManagerInternal {
PACKAGE_CONFIGURATOR,
PACKAGE_INCIDENT_REPORT_APPROVER,
PACKAGE_APP_PREDICTOR,
PACKAGE_TELEPHONY,
PACKAGE_WIFI,
PACKAGE_COMPANION,
PACKAGE_RETAIL_DEMO,

View File

@@ -1548,7 +1548,6 @@ public class PackageManagerService extends IPackageManager.Stub
final @Nullable String mConfiguratorPackage;
final @Nullable String mAppPredictionServicePackage;
final @Nullable String mIncidentReportApproverPackage;
final @Nullable String[] mTelephonyPackages;
final @Nullable String mServicesExtensionPackageName;
final @Nullable String mSharedSystemSharedLibraryPackageName;
final @Nullable String mRetailDemoPackage;
@@ -3181,7 +3180,6 @@ public class PackageManagerService extends IPackageManager.Stub
mConfiguratorPackage = getDeviceConfiguratorPackageName();
mAppPredictionServicePackage = getAppPredictionServicePackageName();
mIncidentReportApproverPackage = getIncidentReportApproverPackageName();
mTelephonyPackages = getTelephonyPackageNames();
mRetailDemoPackage = getRetailDemoPackageName();
// Now that we know all of the shared libraries, update all clients to have
@@ -19938,16 +19936,6 @@ public class PackageManagerService extends IPackageManager.Stub
R.string.config_incidentReportApproverPackage));
}
@Override
public String[] getTelephonyPackageNames() {
String names = mContext.getString(R.string.config_telephonyPackages);
String[] telephonyPackageNames = null;
if (!TextUtils.isEmpty(names)) {
telephonyPackageNames = names.trim().split(",");
}
return ensureSystemPackageNames(telephonyPackageNames);
}
@Override
public String getContentCaptureServicePackageName() {
final String flattenedContentCaptureService =
@@ -23335,8 +23323,6 @@ public class PackageManagerService extends IPackageManager.Stub
return filterOnlySystemPackages(mIncidentReportApproverPackage);
case PackageManagerInternal.PACKAGE_APP_PREDICTOR:
return filterOnlySystemPackages(mAppPredictionServicePackage);
case PackageManagerInternal.PACKAGE_TELEPHONY:
return filterOnlySystemPackages(mTelephonyPackages);
case PackageManagerInternal.PACKAGE_COMPANION:
return filterOnlySystemPackages("com.android.companiondevicemanager");
case PackageManagerInternal.PACKAGE_RETAIL_DEMO:

View File

@@ -277,9 +277,6 @@ public final class BasePermission {
public boolean isAppPredictor() {
return (protectionLevel & PermissionInfo.PROTECTION_FLAG_APP_PREDICTOR) != 0;
}
public boolean isTelephony() {
return (protectionLevel & PermissionInfo.PROTECTION_FLAG_TELEPHONY) != 0;
}
public boolean isCompanion() {
return (protectionLevel & PermissionInfo.PROTECTION_FLAG_COMPANION) != 0;
}

View File

@@ -3464,13 +3464,6 @@ public class PermissionManagerService extends IPermissionManager.Stub {
// Special permissions for the system app predictor.
allowed = true;
}
if (!allowed && bp.isTelephony()
&& ArrayUtils.contains(mPackageManagerInt.getKnownPackageNames(
PackageManagerInternal.PACKAGE_TELEPHONY, UserHandle.USER_SYSTEM),
pkg.getPackageName())) {
// Special permissions for the system telephony apps.
allowed = true;
}
if (!allowed && bp.isCompanion()
&& ArrayUtils.contains(mPackageManagerInt.getKnownPackageNames(
PackageManagerInternal.PACKAGE_COMPANION, UserHandle.USER_SYSTEM),