[MS16.2] Change exception handling for Data Usage APIs

Test: TH
Bug: 204830222
Change-Id: If4e37f227adcabf6901d70ba0bee0dc29b9b3bdc
This commit is contained in:
Junyu Lai
2021-12-23 03:34:40 +00:00
parent 81b2bcc7aa
commit 1fb998b864
3 changed files with 4 additions and 7 deletions

View File

@@ -32,7 +32,6 @@ import android.net.INetworkStatsSession;
import android.net.NetworkPolicy;
import android.net.NetworkPolicyManager;
import android.net.NetworkTemplate;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -172,7 +171,7 @@ public class DataUsageController {
return bucket.getRxBytes() + bucket.getTxBytes();
}
Log.w(TAG, "Failed to get data usage, no entry data");
} catch (RemoteException e) {
} catch (RuntimeException e) {
Log.w(TAG, "Failed to get data usage, remote call failed");
}
return -1L;

View File

@@ -18,7 +18,6 @@ package com.android.settingslib.net;
import android.app.usage.NetworkStats;
import android.content.Context;
import android.os.RemoteException;
import android.util.Log;
import java.util.ArrayList;
@@ -54,7 +53,7 @@ public class NetworkCycleChartDataLoader
.setTotalUsage(total);
mData.add(builder.build());
}
} catch (RemoteException e) {
} catch (RuntimeException e) {
Log.e(TAG, "Exception querying network detail.", e);
}
}
@@ -85,7 +84,7 @@ public class NetworkCycleChartDataLoader
if (bucket != null) {
usage = bucket.getRxBytes() + bucket.getTxBytes();
}
} catch (RemoteException e) {
} catch (RuntimeException e) {
Log.e(TAG, "Exception querying network detail.", e);
}
data.add(new NetworkCycleData.Builder()

View File

@@ -20,7 +20,6 @@ import android.app.usage.NetworkStats;
import android.app.usage.NetworkStatsManager;
import android.content.Context;
import android.net.NetworkTemplate;
import android.os.RemoteException;
import android.util.Log;
import androidx.loader.content.AsyncTaskLoader;
@@ -55,7 +54,7 @@ public class NetworkStatsSummaryLoader extends AsyncTaskLoader<NetworkStats> {
public NetworkStats loadInBackground() {
try {
return mNetworkStatsManager.querySummary(mNetworkTemplate, mStart, mEnd);
} catch (RemoteException e) {
} catch (RuntimeException e) {
Log.e(TAG, "Exception querying network detail.", e);
return null;
}