Throw at getPackageSizeInfoAsUser() callers.
But only when targeting O; if they're old apps then log and pass a soft failure message to their callback. Test: builds, boots Bug: 35749102 Change-Id: I6c6b5a37c23669e7b1ed3c30207bca610821eb1f
This commit is contained in:
@@ -65,6 +65,7 @@ import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -2129,10 +2130,15 @@ public class ApplicationPackageManager extends PackageManager {
|
||||
@Override
|
||||
public void getPackageSizeInfoAsUser(String packageName, int userHandle,
|
||||
IPackageStatsObserver observer) {
|
||||
try {
|
||||
mPM.getPackageSizeInfo(packageName, userHandle, observer);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.O) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Shame on you for calling a hidden API. Shame!");
|
||||
} else if (observer != null) {
|
||||
Log.d(TAG, "Shame on you for calling a hidden API. Shame!");
|
||||
try {
|
||||
observer.onGetStatsCompleted(null, false);
|
||||
} catch (RemoteException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18625,11 +18625,8 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
@Override
|
||||
public void getPackageSizeInfo(final String packageName, int userHandle,
|
||||
final IPackageStatsObserver observer) {
|
||||
Slog.w(TAG, "Shame on you for calling a hidden API. Shame!");
|
||||
try {
|
||||
observer.onGetStatsCompleted(null, false);
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
throw new UnsupportedOperationException(
|
||||
"Shame on you for calling a hidden API. Shame!");
|
||||
}
|
||||
|
||||
private boolean getPackageSizeInfoLI(String packageName, int userId, PackageStats stats) {
|
||||
|
||||
Reference in New Issue
Block a user