Merge "Throw at getPackageSizeInfoAsUser() callers."
This commit is contained in:
committed by
Android (Google) Code Review
commit
35fe82fd54
@@ -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