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

Commit 135f790d authored by Sooraj Sasindran's avatar Sooraj Sasindran
Browse files

Do not use hidden rethrowAsRuntimeException API

Do not use hidden rethrowAsRuntimeException API from
RemoteException.

Bug: 137202333
Test: Make
Merged-In: Idcb007465096f5b139585c7eb0f307fd40edac7f
Change-Id: Idcb007465096f5b139585c7eb0f307fd40edac7f
parent 987e032f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import android.text.TextUtils;

import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConfigurationManager;
import com.android.internal.telephony.util.TelephonyUtils;

import java.util.HashSet;
import java.util.List;
@@ -138,7 +139,7 @@ public class DataServiceManager extends Handler {
                UserHandle.myUserId(), pkgToGrant[0], AppOpsManager.MODE_ALLOWED);
        } catch (RemoteException e) {
            loge("Binder to package manager died, permission grant for DataService failed.");
            throw e.rethrowAsRuntimeException();
            throw TelephonyUtils.rethrowAsRuntimeException(e);
        }
    }

@@ -164,7 +165,7 @@ public class DataServiceManager extends Handler {
            }
        } catch (RemoteException e) {
            loge("Binder to package manager died; failed to revoke DataService permissions.");
            throw e.rethrowAsRuntimeException();
            throw TelephonyUtils.rethrowAsRuntimeException(e);
        }
    }

+7 −1
Original line number Diff line number Diff line
@@ -17,9 +17,10 @@ package com.android.internal.telephony.util;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.SystemProperties;
import android.content.pm.ComponentInfo;
import android.content.pm.ResolveInfo;
import android.os.RemoteException;
import android.os.SystemProperties;

/**
 * This class provides various util functions
@@ -35,6 +36,11 @@ public final class TelephonyUtils {
    public static boolean IS_DEBUGGABLE =
            SystemProperties.getInt("ro.debuggable", 0) == 1;

    /** {@hide} */
    public static RuntimeException rethrowAsRuntimeException(RemoteException remoteException) {
        throw new RuntimeException(remoteException);
    }

    public static ComponentInfo getComponentInfo(@NonNull ResolveInfo resolveInfo) {
        if (resolveInfo.activityInfo != null) return resolveInfo.activityInfo;
        if (resolveInfo.serviceInfo != null) return resolveInfo.serviceInfo;