Search in sources :

Example 6 with INetworkStatsService

use of android.net.INetworkStatsService in project android_packages_apps_Settings by LineageOS.

the class InstalledAppDetails method onCreate.

/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    final Activity activity = getActivity();
    if (!ensurePackageInfoAvailable(activity)) {
        return;
    }
    setHasOptionsMenu(true);
    addPreferencesFromResource(R.xml.installed_app_details);
    addDynamicPrefs();
    if (Utils.isBandwidthControlEnabled()) {
        INetworkStatsService statsService = INetworkStatsService.Stub.asInterface(ServiceManager.getService(Context.NETWORK_STATS_SERVICE));
        try {
            mStatsSession = statsService.openSession();
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
    } else {
        removePreference(KEY_DATA);
    }
    mBatteryUtils = BatteryUtils.getInstance(getContext());
    mDevelopmentSettingsEnabler = new DevelopmentSettingsEnabler(activity, null);
}
Also used : DevelopmentSettingsEnabler(com.android.settings.development.DevelopmentSettingsEnabler) SettingsActivity(com.android.settings.SettingsActivity) Activity(android.app.Activity) INetworkStatsService(android.net.INetworkStatsService) RemoteException(android.os.RemoteException)

Example 7 with INetworkStatsService

use of android.net.INetworkStatsService in project android_packages_apps_Settings by DirtyUnicorns.

the class InstalledAppDetails method onCreate.

/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    final Activity activity = getActivity();
    if (!ensurePackageInfoAvailable(activity)) {
        return;
    }
    setHasOptionsMenu(true);
    addPreferencesFromResource(R.xml.installed_app_details);
    addDynamicPrefs();
    if (Utils.isBandwidthControlEnabled()) {
        INetworkStatsService statsService = INetworkStatsService.Stub.asInterface(ServiceManager.getService(Context.NETWORK_STATS_SERVICE));
        try {
            mStatsSession = statsService.openSession();
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
    } else {
        removePreference(KEY_DATA);
    }
    mBatteryUtils = BatteryUtils.getInstance(getContext());
    mDevelopmentSettingsEnabler = new DevelopmentSettingsEnabler(activity, null);
}
Also used : DevelopmentSettingsEnabler(com.android.settings.development.DevelopmentSettingsEnabler) SettingsActivity(com.android.settings.SettingsActivity) Activity(android.app.Activity) INetworkStatsService(android.net.INetworkStatsService) RemoteException(android.os.RemoteException)

Aggregations

INetworkStatsService (android.net.INetworkStatsService)7 RemoteException (android.os.RemoteException)7 Activity (android.app.Activity)6 SettingsActivity (com.android.settings.SettingsActivity)6 DevelopmentSettingsEnabler (com.android.settings.development.DevelopmentSettingsEnabler)6 BatteryStatsHelper (com.android.internal.os.BatteryStatsHelper)1