Deprecate and no-op test API getContentCaptureServicePackageName

After the fix for b/222231605, permission pre-grants are no longer tied
to the package that provides ContentCaptureService, so this test API is
no longer needed. However the API is still referenced from GTS tests
(though it won't be invoked on T and above), so we need to keep the
method in the SDK to compile the test code.

Bug: 229662628
Test: Presubmit
Change-Id: Iddc201ba8afde816446377e509a3f2de35215f61
This commit is contained in:
Nikita Dubrovsky
2022-04-22 10:14:56 -07:00
parent 7e00eeb8de
commit 22f3baa869
5 changed files with 10 additions and 23 deletions

View File

@@ -823,7 +823,7 @@ package android.content.pm {
}
public abstract class PackageManager {
method @Nullable public String getContentCaptureServicePackageName();
method @Deprecated @Nullable public final String getContentCaptureServicePackageName();
method @Nullable public String getDefaultTextClassifierPackageName();
method @RequiresPermission(android.Manifest.permission.INJECT_EVENTS) public android.os.IBinder getHoldLockToken();
method public abstract int getInstallReason(@NonNull String, @NonNull android.os.UserHandle);

View File

@@ -3656,15 +3656,6 @@ public class ApplicationPackageManager extends PackageManager {
}
}
@Override
public String getContentCaptureServicePackageName() {
try {
return mPM.getContentCaptureServicePackageName();
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
}
@Override
public boolean isPackageStateProtected(String packageName, int userId) {
try {

View File

@@ -715,8 +715,6 @@ interface IPackageManager {
String getIncidentReportApproverPackageName();
String getContentCaptureServicePackageName();
boolean isPackageStateProtected(String packageName, int userId);
void sendDeviceCustomizationReadyBroadcast();

View File

@@ -10083,15 +10083,21 @@ public abstract class PackageManager {
}
/**
* @return the system defined content capture package name, or null if there's none.
* @deprecated This function throws an {@link UnsupportedOperationException}. For pre-granting
* permissions, instead of looking up the package that provides {@code ContentCaptureService},
* use roles.
*
* @hide
*/
// This function cannot yet be removed because it is referenced from GTS tests. The tests have
// been updated to not rely on it when running on Android T and above, but in order to compile
// the tests we must keep this method.
@Deprecated
@TestApi
@Nullable
public String getContentCaptureServicePackageName() {
public final String getContentCaptureServicePackageName() {
throw new UnsupportedOperationException(
"getContentCaptureServicePackageName not implemented in subclass");
"getContentCaptureServicePackageName is deprecated");
}
/**

View File

@@ -387,14 +387,6 @@ public abstract class IPackageManagerBase extends IPackageManager.Stub {
return snapshot().getComponentEnabledSetting(component, Binder.getCallingUid(), userId);
}
@Override
@Deprecated
public final String getContentCaptureServicePackageName() {
return mService.ensureSystemPackageName(snapshot(),
mService.getPackageFromComponentString(
R.string.config_defaultContentCaptureService));
}
@Nullable
@Override
@Deprecated