Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22f3baa8 authored by Nikita Dubrovsky's avatar Nikita Dubrovsky
Browse files

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
parent 7e00eeb8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+0 −9
Original line number Diff line number Diff line
@@ -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 {
+0 −2
Original line number Diff line number Diff line
@@ -715,8 +715,6 @@ interface IPackageManager {

    String getIncidentReportApproverPackageName();

    String getContentCaptureServicePackageName();

    boolean isPackageStateProtected(String packageName, int userId);

    void sendDeviceCustomizationReadyBroadcast();
+9 −3
Original line number Diff line number Diff line
@@ -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");
    }

    /**
+0 −8
Original line number Diff line number Diff line
@@ -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