Switch to throw e.rethrowFromSystemServer().

The official guidance is to explicitly throw
RemoteException.rethrowFromSystemServer() instead of just calling the
method.

Bug: 141645789
Test: Android builds
Change-Id: I37c29eb3740141e91cae5e604b58fd419d837b33
This commit is contained in:
Kweku Adams
2020-02-28 13:56:03 -08:00
parent 9d95b2bf8e
commit e904f46ee3
2 changed files with 6 additions and 12 deletions

View File

@@ -53,8 +53,7 @@ public class DeviceIdleManager {
try {
return mService.getSystemPowerWhitelistExceptIdle();
} catch (RemoteException e) {
e.rethrowFromSystemServer();
return new String[0];
throw e.rethrowFromSystemServer();
}
}
@@ -66,8 +65,7 @@ public class DeviceIdleManager {
try {
return mService.getSystemPowerWhitelist();
} catch (RemoteException e) {
e.rethrowFromSystemServer();
return new String[0];
throw e.rethrowFromSystemServer();
}
}

View File

@@ -24,8 +24,6 @@ import android.annotation.SystemService;
import android.annotation.TestApi;
import android.content.Context;
import libcore.util.EmptyArray;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collections;
@@ -97,7 +95,7 @@ public class PowerWhitelistManager {
try {
mService.addPowerSaveWhitelistApps(packageNames);
} catch (RemoteException e) {
e.rethrowFromSystemServer();
throw e.rethrowFromSystemServer();
}
}
@@ -118,8 +116,7 @@ public class PowerWhitelistManager {
return mService.getAppIdWhitelistExceptIdle();
}
} catch (RemoteException e) {
e.rethrowFromSystemServer();
return EmptyArray.INT;
throw e.rethrowFromSystemServer();
}
}
@@ -136,7 +133,7 @@ public class PowerWhitelistManager {
mService.addPowerSaveTempWhitelistApp(packageName, durationMs, mContext.getUserId(),
reason);
} catch (RemoteException e) {
e.rethrowFromSystemServer();
throw e.rethrowFromSystemServer();
}
}
@@ -166,8 +163,7 @@ public class PowerWhitelistManager {
packageName, mContext.getUserId(), reason);
}
} catch (RemoteException e) {
e.rethrowFromSystemServer();
return 0;
throw e.rethrowFromSystemServer();
}
}
}