Revert "Throw at getPackageSizeInfoAsUser() callers."

This reverts commit 597c93454699eaed99d6b417080417d75777e72d.

Change-Id: I7d966ef973050ef791403062774fd7f576a65388
(cherry picked from commit dd3adc339808ebb5eb2d1e73a8b0a0bd09f9455a)
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 97992ca..64e2d49 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -65,7 +65,6 @@
 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;
@@ -2130,15 +2129,10 @@
     @Override
     public void getPackageSizeInfoAsUser(String packageName, int userHandle,
             IPackageStatsObserver observer) {
-        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) {
-            }
+        try {
+            mPM.getPackageSizeInfo(packageName, userHandle, observer);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
         }
     }
 
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index e2358c2..aff28320 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -18625,8 +18625,11 @@
     @Override
     public void getPackageSizeInfo(final String packageName, int userHandle,
             final IPackageStatsObserver observer) {
-        throw new UnsupportedOperationException(
-                "Shame on you for calling a hidden API. Shame!");
+        Slog.w(TAG, "Shame on you for calling a hidden API. Shame!");
+        try {
+            observer.onGetStatsCompleted(null, false);
+        } catch (Throwable ignored) {
+        }
     }
 
     private boolean getPackageSizeInfoLI(String packageName, int userId, PackageStats stats) {