Remove updateShortcutVisibility

ShortcutManager#updateShortcutVisiblity was a new api intended for S,
due to the recent rollback of shortcut-appsearch integration, this api
can no longer be backed up AppSearch#VisibilityStore. To minimize the
risk of S release we should removed it from public api as opposed to
creating an alternative implementation.

Bug: 185828535, 185177108
Test: manual
Change-Id: Ic9d18237a25b11975f5859836877b9f77e25cc61
This commit is contained in:
Pinyao Ting
2021-04-22 15:43:34 -07:00
parent 00475ff23d
commit d80460c376
5 changed files with 0 additions and 69 deletions

View File

@@ -13069,7 +13069,6 @@ package android.content.pm {
method public void reportShortcutUsed(String);
method @WorkerThread public boolean requestPinShortcut(@NonNull android.content.pm.ShortcutInfo, @Nullable android.content.IntentSender);
method @WorkerThread public boolean setDynamicShortcuts(@NonNull java.util.List<android.content.pm.ShortcutInfo>);
method public void updateShortcutVisibility(@NonNull String, @Nullable byte[], boolean);
method @WorkerThread public boolean updateShortcuts(@NonNull java.util.List<android.content.pm.ShortcutInfo>);
field public static final int FLAG_MATCH_CACHED = 8; // 0x8
field public static final int FLAG_MATCH_DYNAMIC = 2; // 0x2

View File

@@ -81,7 +81,4 @@ interface IShortcutService {
AndroidFuture<ParceledListSlice> getShortcuts(String packageName, int matchFlags, int userId);
AndroidFuture pushDynamicShortcut(String packageName, in ShortcutInfo shortcut, int userId);
AndroidFuture updateShortcutVisibility(String callingPkg, String packageName,
in byte[] certificate, in boolean visible, int userId);
}

View File

@@ -40,7 +40,6 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.infra.AndroidFuture;
@@ -790,23 +789,6 @@ public class ShortcutManager {
}
}
/**
* Granting another app the access to the shortcuts you own. You must provide the package name
* and their SHA256 certificate digest in order to granting the access.
*
* Once granted, the other app can retain a copy of all the shortcuts you own when calling
* {@link LauncherApps#getShortcuts(LauncherApps.ShortcutQuery, UserHandle)}.
*/
public void updateShortcutVisibility(@NonNull final String packageName,
@Nullable final byte[] certificate, final boolean visible) {
try {
getFutureOrThrow(mService.updateShortcutVisibility(mContext.getPackageName(),
packageName, certificate, visible, injectMyUserId()));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
private static <T> T getFutureOrThrow(@NonNull AndroidFuture<T> future) {
try {
return future.get();

View File

@@ -2250,24 +2250,6 @@ public class ShortcutService extends IShortcutService.Stub {
return ret;
}
@Override
public AndroidFuture updateShortcutVisibility(String callingPkg, String packageName,
byte[] certificate, boolean visible, int userId) {
final AndroidFuture<Void> ret = new AndroidFuture<>();
injectPostToHandlerIfAppSearch(() -> {
try {
synchronized (mLock) {
getPackageShortcutsForPublisherLocked(callingPkg, userId)
.updateVisibility(packageName, certificate, visible);
}
ret.complete(null);
} catch (Exception e) {
ret.completeExceptionally(e);
}
});
return ret;
}
@Override
public AndroidFuture requestPinShortcut(String packageName, ShortcutInfo shortcut,
IntentSender resultIntent, int userId) {

View File

@@ -15,20 +15,11 @@
*/
package com.android.server.pm;
import static android.provider.DeviceConfig.NAMESPACE_SYSTEMUI;
import static com.android.server.pm.shortcutmanagertest.ShortcutManagerTestUtils.list;
import android.app.PendingIntent;
import android.app.appsearch.PackageIdentifier;
import android.content.pm.AppSearchShortcutInfo;
import android.os.RemoteException;
import android.os.UserHandle;
import android.provider.DeviceConfig;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
import java.util.Random;
/**
* Tests for {@link android.app.appsearch.AppSearchManager} and relevant APIs in ShortcutManager.
@@ -37,26 +28,6 @@ import java.util.Random;
*/
public class ShortcutManagerTest12 extends BaseShortcutManagerTest {
public void testUpdateShortcutVisibility_updatesShortcutSchema() {
if (!DeviceConfig.getBoolean(NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.DARK_LAUNCH_REMOTE_PREDICTION_SERVICE_ENABLED,
false)) {
// no-op if app-search integration is disabled.
return;
}
final byte[] cert = new byte[20];
new Random().nextBytes(cert);
runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
mManager.updateShortcutVisibility(CALLING_PACKAGE_2, cert, true);
assertTrue(mMockAppSearchManager.mSchemasPackageAccessible.containsKey(
AppSearchShortcutInfo.SCHEMA_TYPE));
assertTrue(mMockAppSearchManager.mSchemasPackageAccessible.get(
AppSearchShortcutInfo.SCHEMA_TYPE).get(0).equals(
new PackageIdentifier(CALLING_PACKAGE_2, cert)));
});
}
public void testGetShortcutIntents_ReturnsMutablePendingIntents() throws RemoteException {
setDefaultLauncher(USER_0, LAUNCHER_1);