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

Commit 1fb998b8 authored by Junyu Lai's avatar Junyu Lai
Browse files

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

Test: TH
Bug: 204830222
Change-Id: If4e37f227adcabf6901d70ba0bee0dc29b9b3bdc
parent 81b2bcc7
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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;
+2 −3
Original line number Diff line number Diff line
@@ -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()
+1 −2
Original line number Diff line number Diff line
@@ -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;
        }