Restrict access to dangerous methods to <= P

Test: make
Fixes: 130143562
Change-Id: I1a6a472f83cf00a1ab174a9c5e67d3e9357a0c45
Merged-In: I95107f7b628eecb54e9f4411785186b668e9f3d8
Merged-In: I890030580fdad45c3f8589bf6adbe5798d578cfe
(cherry picked from commit 0bb53dbb64bbc937a23e1dc7641c8988a6d11d64)
This commit is contained in:
Chalard Jean
2019-04-09 15:46:21 +09:00
parent db81a2a52e
commit a69a73ece7

View File

@@ -25,6 +25,7 @@ import android.app.backup.BackupManager;
import android.app.usage.NetworkStatsManager; import android.app.usage.NetworkStatsManager;
import android.content.Context; import android.content.Context;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Build;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.util.DataUnit; import android.util.DataUnit;
@@ -150,7 +151,7 @@ public class TrafficStats {
private static INetworkStatsService sStatsService; private static INetworkStatsService sStatsService;
@UnsupportedAppUsage @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 130143562)
private synchronized static INetworkStatsService getStatsService() { private synchronized static INetworkStatsService getStatsService() {
if (sStatsService == null) { if (sStatsService == null) {
sStatsService = INetworkStatsService.Stub.asInterface( sStatsService = INetworkStatsService.Stub.asInterface(
@@ -960,7 +961,7 @@ public class TrafficStats {
* Interfaces are never removed from this list, so counters should always be * Interfaces are never removed from this list, so counters should always be
* monotonic. * monotonic.
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 130143562)
private static String[] getMobileIfaces() { private static String[] getMobileIfaces() {
try { try {
return getStatsService().getMobileIfaces(); return getStatsService().getMobileIfaces();