Search in sources :

Example 6 with UidDetail

use of com.android.settingslib.net.UidDetail in project android_packages_apps_Settings by LineageOS.

the class AppDataUsage method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mPackageManagerWrapper = new PackageManagerWrapperImpl(getPackageManager());
    final Bundle args = getArguments();
    try {
        mStatsSession = services.mStatsService.openSession();
    } catch (RemoteException e) {
        throw new RuntimeException(e);
    }
    mAppItem = (args != null) ? (AppItem) args.getParcelable(ARG_APP_ITEM) : null;
    mTemplate = (args != null) ? (NetworkTemplate) args.getParcelable(ARG_NETWORK_TEMPLATE) : null;
    if (mTemplate == null) {
        Context context = getContext();
        mTemplate = DataUsageUtils.getDefaultTemplate(context, DataUsageUtils.getDefaultSubscriptionId(context));
    }
    if (mAppItem == null) {
        int uid = (args != null) ? args.getInt(AppInfoBase.ARG_PACKAGE_UID, -1) : getActivity().getIntent().getIntExtra(AppInfoBase.ARG_PACKAGE_UID, -1);
        if (uid == -1) {
            // TODO: Log error.
            getActivity().finish();
        } else {
            addUid(uid);
            mAppItem = new AppItem(uid);
            mAppItem.addUid(uid);
        }
    } else {
        for (int i = 0; i < mAppItem.uids.size(); i++) {
            addUid(mAppItem.uids.keyAt(i));
        }
    }
    addPreferencesFromResource(R.xml.app_data_usage);
    mTotalUsage = findPreference(KEY_TOTAL_USAGE);
    mForegroundUsage = findPreference(KEY_FOREGROUND_USAGE);
    mBackgroundUsage = findPreference(KEY_BACKGROUND_USAGE);
    mCycle = (SpinnerPreference) findPreference(KEY_CYCLE);
    mCycleAdapter = new CycleAdapter(getContext(), mCycle, mCycleListener, false);
    if (mAppItem.key > 0) {
        if (mPackages.size() != 0) {
            try {
                ApplicationInfo info = mPackageManagerWrapper.getApplicationInfoAsUser(mPackages.valueAt(0), 0, UserHandle.getUserId(mAppItem.key));
                mIcon = IconDrawableFactory.newInstance(getActivity()).getBadgedIcon(info);
                mLabel = info.loadLabel(mPackageManagerWrapper.getPackageManager());
                mPackageName = info.packageName;
            } catch (PackageManager.NameNotFoundException e) {
            }
        }
        if (!UserHandle.isApp(mAppItem.key)) {
            removePreference(KEY_UNRESTRICTED_DATA);
            removePreference(KEY_RESTRICT_BACKGROUND);
        } else {
            mRestrictBackground = (SwitchPreference) findPreference(KEY_RESTRICT_BACKGROUND);
            mRestrictBackground.setOnPreferenceChangeListener(this);
            mUnrestrictedData = (SwitchPreference) findPreference(KEY_UNRESTRICTED_DATA);
            mUnrestrictedData.setOnPreferenceChangeListener(this);
        }
        mDataSaverBackend = new DataSaverBackend(getContext());
        mAppSettings = findPreference(KEY_APP_SETTINGS);
        mAppSettingsIntent = new Intent(Intent.ACTION_MANAGE_NETWORK_USAGE);
        mAppSettingsIntent.addCategory(Intent.CATEGORY_DEFAULT);
        PackageManager pm = getPackageManager();
        boolean matchFound = false;
        for (String packageName : mPackages) {
            mAppSettingsIntent.setPackage(packageName);
            if (pm.resolveActivity(mAppSettingsIntent, 0) != null) {
                matchFound = true;
                break;
            }
        }
        if (!matchFound) {
            removePreference(KEY_APP_SETTINGS);
            mAppSettings = null;
        }
        if (mPackages.size() > 1) {
            mAppList = (PreferenceCategory) findPreference(KEY_APP_LIST);
            getLoaderManager().initLoader(LOADER_APP_PREF, Bundle.EMPTY, mAppPrefCallbacks);
        } else {
            removePreference(KEY_APP_LIST);
        }
    } else {
        final Context context = getActivity();
        UidDetail uidDetail = new UidDetailProvider(context).getUidDetail(mAppItem.key, true);
        mIcon = uidDetail.icon;
        mLabel = uidDetail.label;
        mPackageName = context.getPackageName();
        removePreference(KEY_UNRESTRICTED_DATA);
        removePreference(KEY_APP_SETTINGS);
        removePreference(KEY_RESTRICT_BACKGROUND);
        removePreference(KEY_APP_LIST);
    }
}
Also used : Context(android.content.Context) Bundle(android.os.Bundle) ApplicationInfo(android.content.pm.ApplicationInfo) Intent(android.content.Intent) PackageManagerWrapperImpl(com.android.settings.applications.PackageManagerWrapperImpl) NetworkTemplate(android.net.NetworkTemplate) UidDetail(com.android.settingslib.net.UidDetail) PackageManager(android.content.pm.PackageManager) AppItem(com.android.settingslib.AppItem) RemoteException(android.os.RemoteException) UidDetailProvider(com.android.settingslib.net.UidDetailProvider)

Example 7 with UidDetail

use of com.android.settingslib.net.UidDetail in project android_packages_apps_Settings by DirtyUnicorns.

the class AppDataUsage method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mPackageManagerWrapper = new PackageManagerWrapperImpl(getPackageManager());
    final Bundle args = getArguments();
    try {
        mStatsSession = services.mStatsService.openSession();
    } catch (RemoteException e) {
        throw new RuntimeException(e);
    }
    mAppItem = (args != null) ? (AppItem) args.getParcelable(ARG_APP_ITEM) : null;
    mTemplate = (args != null) ? (NetworkTemplate) args.getParcelable(ARG_NETWORK_TEMPLATE) : null;
    if (mTemplate == null) {
        Context context = getContext();
        mTemplate = DataUsageUtils.getDefaultTemplate(context, DataUsageUtils.getDefaultSubscriptionId(context));
    }
    if (mAppItem == null) {
        int uid = (args != null) ? args.getInt(AppInfoBase.ARG_PACKAGE_UID, -1) : getActivity().getIntent().getIntExtra(AppInfoBase.ARG_PACKAGE_UID, -1);
        if (uid == -1) {
            // TODO: Log error.
            getActivity().finish();
        } else {
            addUid(uid);
            mAppItem = new AppItem(uid);
            mAppItem.addUid(uid);
        }
    } else {
        for (int i = 0; i < mAppItem.uids.size(); i++) {
            addUid(mAppItem.uids.keyAt(i));
        }
    }
    addPreferencesFromResource(R.xml.app_data_usage);
    mTotalUsage = findPreference(KEY_TOTAL_USAGE);
    mForegroundUsage = findPreference(KEY_FOREGROUND_USAGE);
    mBackgroundUsage = findPreference(KEY_BACKGROUND_USAGE);
    mCycle = (SpinnerPreference) findPreference(KEY_CYCLE);
    mCycleAdapter = new CycleAdapter(getContext(), mCycle, mCycleListener, false);
    if (mAppItem.key > 0) {
        if (mPackages.size() != 0) {
            try {
                ApplicationInfo info = mPackageManagerWrapper.getApplicationInfoAsUser(mPackages.valueAt(0), 0, UserHandle.getUserId(mAppItem.key));
                mIcon = IconDrawableFactory.newInstance(getActivity()).getBadgedIcon(info);
                mLabel = info.loadLabel(mPackageManagerWrapper.getPackageManager());
                mPackageName = info.packageName;
            } catch (PackageManager.NameNotFoundException e) {
            }
        }
        if (!UserHandle.isApp(mAppItem.key)) {
            removePreference(KEY_UNRESTRICTED_DATA);
            removePreference(KEY_RESTRICT_BACKGROUND);
        } else {
            mRestrictBackground = (SwitchPreference) findPreference(KEY_RESTRICT_BACKGROUND);
            mRestrictBackground.setOnPreferenceChangeListener(this);
            mUnrestrictedData = (SwitchPreference) findPreference(KEY_UNRESTRICTED_DATA);
            mUnrestrictedData.setOnPreferenceChangeListener(this);
        }
        mDataSaverBackend = new DataSaverBackend(getContext());
        mAppSettings = findPreference(KEY_APP_SETTINGS);
        mAppSettingsIntent = new Intent(Intent.ACTION_MANAGE_NETWORK_USAGE);
        mAppSettingsIntent.addCategory(Intent.CATEGORY_DEFAULT);
        PackageManager pm = getPackageManager();
        boolean matchFound = false;
        for (String packageName : mPackages) {
            mAppSettingsIntent.setPackage(packageName);
            if (pm.resolveActivity(mAppSettingsIntent, 0) != null) {
                matchFound = true;
                break;
            }
        }
        if (!matchFound) {
            removePreference(KEY_APP_SETTINGS);
            mAppSettings = null;
        }
        if (mPackages.size() > 1) {
            mAppList = (PreferenceCategory) findPreference(KEY_APP_LIST);
            getLoaderManager().initLoader(LOADER_APP_PREF, Bundle.EMPTY, mAppPrefCallbacks);
        } else {
            removePreference(KEY_APP_LIST);
        }
    } else {
        final Context context = getActivity();
        UidDetail uidDetail = new UidDetailProvider(context).getUidDetail(mAppItem.key, true);
        mIcon = uidDetail.icon;
        mLabel = uidDetail.label;
        mPackageName = context.getPackageName();
        removePreference(KEY_UNRESTRICTED_DATA);
        removePreference(KEY_APP_SETTINGS);
        removePreference(KEY_RESTRICT_BACKGROUND);
        removePreference(KEY_APP_LIST);
    }
}
Also used : Context(android.content.Context) Bundle(android.os.Bundle) ApplicationInfo(android.content.pm.ApplicationInfo) Intent(android.content.Intent) PackageManagerWrapperImpl(com.android.settings.applications.PackageManagerWrapperImpl) NetworkTemplate(android.net.NetworkTemplate) UidDetail(com.android.settingslib.net.UidDetail) PackageManager(android.content.pm.PackageManager) AppItem(com.android.settingslib.AppItem) RemoteException(android.os.RemoteException) UidDetailProvider(com.android.settingslib.net.UidDetailProvider)

Example 8 with UidDetail

use of com.android.settingslib.net.UidDetail in project android_packages_apps_Settings by crdroidandroid.

the class AppDataUsage method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mPackageManagerWrapper = new PackageManagerWrapperImpl(getPackageManager());
    final Bundle args = getArguments();
    try {
        mStatsSession = services.mStatsService.openSession();
    } catch (RemoteException e) {
        throw new RuntimeException(e);
    }
    mAppItem = (args != null) ? (AppItem) args.getParcelable(ARG_APP_ITEM) : null;
    mTemplate = (args != null) ? (NetworkTemplate) args.getParcelable(ARG_NETWORK_TEMPLATE) : null;
    if (mTemplate == null) {
        Context context = getContext();
        mTemplate = DataUsageUtils.getDefaultTemplate(context, DataUsageUtils.getDefaultSubscriptionId(context));
    }
    if (mAppItem == null) {
        int uid = (args != null) ? args.getInt(AppInfoBase.ARG_PACKAGE_UID, -1) : getActivity().getIntent().getIntExtra(AppInfoBase.ARG_PACKAGE_UID, -1);
        if (uid == -1) {
            // TODO: Log error.
            getActivity().finish();
        } else {
            addUid(uid);
            mAppItem = new AppItem(uid);
            mAppItem.addUid(uid);
        }
    } else {
        for (int i = 0; i < mAppItem.uids.size(); i++) {
            addUid(mAppItem.uids.keyAt(i));
        }
    }
    addPreferencesFromResource(R.xml.app_data_usage);
    mTotalUsage = findPreference(KEY_TOTAL_USAGE);
    mForegroundUsage = findPreference(KEY_FOREGROUND_USAGE);
    mBackgroundUsage = findPreference(KEY_BACKGROUND_USAGE);
    mCycle = (SpinnerPreference) findPreference(KEY_CYCLE);
    mCycleAdapter = new CycleAdapter(getContext(), mCycle, mCycleListener, false);
    if (mAppItem.key > 0) {
        if (mPackages.size() != 0) {
            try {
                ApplicationInfo info = mPackageManagerWrapper.getApplicationInfoAsUser(mPackages.valueAt(0), 0, UserHandle.getUserId(mAppItem.key));
                mIcon = IconDrawableFactory.newInstance(getActivity()).getBadgedIcon(info);
                mLabel = info.loadLabel(mPackageManagerWrapper.getPackageManager());
                mPackageName = info.packageName;
            } catch (PackageManager.NameNotFoundException e) {
            }
        }
        if (!UserHandle.isApp(mAppItem.key)) {
            removePreference(KEY_UNRESTRICTED_DATA);
            removePreference(KEY_RESTRICT_BACKGROUND);
        } else {
            mRestrictBackground = (SwitchPreference) findPreference(KEY_RESTRICT_BACKGROUND);
            mRestrictBackground.setOnPreferenceChangeListener(this);
            mUnrestrictedData = (SwitchPreference) findPreference(KEY_UNRESTRICTED_DATA);
            mUnrestrictedData.setOnPreferenceChangeListener(this);
        }
        mDataSaverBackend = new DataSaverBackend(getContext());
        mAppSettings = findPreference(KEY_APP_SETTINGS);
        mAppSettingsIntent = new Intent(Intent.ACTION_MANAGE_NETWORK_USAGE);
        mAppSettingsIntent.addCategory(Intent.CATEGORY_DEFAULT);
        PackageManager pm = getPackageManager();
        boolean matchFound = false;
        for (String packageName : mPackages) {
            mAppSettingsIntent.setPackage(packageName);
            if (pm.resolveActivity(mAppSettingsIntent, 0) != null) {
                matchFound = true;
                break;
            }
        }
        if (!matchFound) {
            removePreference(KEY_APP_SETTINGS);
            mAppSettings = null;
        }
        if (mPackages.size() > 1) {
            mAppList = (PreferenceCategory) findPreference(KEY_APP_LIST);
            getLoaderManager().initLoader(LOADER_APP_PREF, Bundle.EMPTY, mAppPrefCallbacks);
        } else {
            removePreference(KEY_APP_LIST);
        }
    } else {
        final Context context = getActivity();
        UidDetail uidDetail = new UidDetailProvider(context).getUidDetail(mAppItem.key, true);
        mIcon = uidDetail.icon;
        mLabel = uidDetail.label;
        mPackageName = context.getPackageName();
        removePreference(KEY_UNRESTRICTED_DATA);
        removePreference(KEY_APP_SETTINGS);
        removePreference(KEY_RESTRICT_BACKGROUND);
        removePreference(KEY_APP_LIST);
    }
}
Also used : Context(android.content.Context) Bundle(android.os.Bundle) ApplicationInfo(android.content.pm.ApplicationInfo) Intent(android.content.Intent) PackageManagerWrapperImpl(com.android.settings.applications.PackageManagerWrapperImpl) NetworkTemplate(android.net.NetworkTemplate) UidDetail(com.android.settingslib.net.UidDetail) PackageManager(android.content.pm.PackageManager) AppItem(com.android.settingslib.AppItem) RemoteException(android.os.RemoteException) UidDetailProvider(com.android.settingslib.net.UidDetailProvider)

Example 9 with UidDetail

use of com.android.settingslib.net.UidDetail in project android_packages_apps_Settings by SudaMod.

the class AppDataUsage method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mPackageManagerWrapper = new PackageManagerWrapperImpl(getPackageManager());
    final Bundle args = getArguments();
    try {
        mStatsSession = services.mStatsService.openSession();
    } catch (RemoteException e) {
        throw new RuntimeException(e);
    }
    mAppItem = (args != null) ? (AppItem) args.getParcelable(ARG_APP_ITEM) : null;
    mTemplate = (args != null) ? (NetworkTemplate) args.getParcelable(ARG_NETWORK_TEMPLATE) : null;
    if (mTemplate == null) {
        Context context = getContext();
        mTemplate = DataUsageUtils.getDefaultTemplate(context, DataUsageUtils.getDefaultSubscriptionId(context));
    }
    if (mAppItem == null) {
        int uid = (args != null) ? args.getInt(AppInfoBase.ARG_PACKAGE_UID, -1) : getActivity().getIntent().getIntExtra(AppInfoBase.ARG_PACKAGE_UID, -1);
        if (uid == -1) {
            // TODO: Log error.
            getActivity().finish();
        } else {
            addUid(uid);
            mAppItem = new AppItem(uid);
            mAppItem.addUid(uid);
        }
    } else {
        for (int i = 0; i < mAppItem.uids.size(); i++) {
            addUid(mAppItem.uids.keyAt(i));
        }
    }
    addPreferencesFromResource(R.xml.app_data_usage);
    mTotalUsage = findPreference(KEY_TOTAL_USAGE);
    mForegroundUsage = findPreference(KEY_FOREGROUND_USAGE);
    mBackgroundUsage = findPreference(KEY_BACKGROUND_USAGE);
    mCycle = (SpinnerPreference) findPreference(KEY_CYCLE);
    mCycleAdapter = new CycleAdapter(getContext(), mCycle, mCycleListener, false);
    if (mAppItem.key > 0) {
        if (mPackages.size() != 0) {
            try {
                ApplicationInfo info = mPackageManagerWrapper.getApplicationInfoAsUser(mPackages.valueAt(0), 0, UserHandle.getUserId(mAppItem.key));
                mIcon = IconDrawableFactory.newInstance(getActivity()).getBadgedIcon(info);
                mLabel = info.loadLabel(mPackageManagerWrapper.getPackageManager());
                mPackageName = info.packageName;
            } catch (PackageManager.NameNotFoundException e) {
            }
        }
        if (!UserHandle.isApp(mAppItem.key)) {
            removePreference(KEY_UNRESTRICTED_DATA);
            removePreference(KEY_RESTRICT_BACKGROUND);
        } else {
            mRestrictBackground = (SwitchPreference) findPreference(KEY_RESTRICT_BACKGROUND);
            mRestrictBackground.setOnPreferenceChangeListener(this);
            mUnrestrictedData = (SwitchPreference) findPreference(KEY_UNRESTRICTED_DATA);
            mUnrestrictedData.setOnPreferenceChangeListener(this);
        }
        mDataSaverBackend = new DataSaverBackend(getContext());
        mAppSettings = findPreference(KEY_APP_SETTINGS);
        mAppSettingsIntent = new Intent(Intent.ACTION_MANAGE_NETWORK_USAGE);
        mAppSettingsIntent.addCategory(Intent.CATEGORY_DEFAULT);
        PackageManager pm = getPackageManager();
        boolean matchFound = false;
        for (String packageName : mPackages) {
            mAppSettingsIntent.setPackage(packageName);
            if (pm.resolveActivity(mAppSettingsIntent, 0) != null) {
                matchFound = true;
                break;
            }
        }
        if (!matchFound) {
            removePreference(KEY_APP_SETTINGS);
            mAppSettings = null;
        }
        if (mPackages.size() > 1) {
            mAppList = (PreferenceCategory) findPreference(KEY_APP_LIST);
            getLoaderManager().initLoader(LOADER_APP_PREF, Bundle.EMPTY, mAppPrefCallbacks);
        } else {
            removePreference(KEY_APP_LIST);
        }
    } else {
        final Context context = getActivity();
        UidDetail uidDetail = new UidDetailProvider(context).getUidDetail(mAppItem.key, true);
        mIcon = uidDetail.icon;
        mLabel = uidDetail.label;
        mPackageName = context.getPackageName();
        removePreference(KEY_UNRESTRICTED_DATA);
        removePreference(KEY_APP_SETTINGS);
        removePreference(KEY_RESTRICT_BACKGROUND);
        removePreference(KEY_APP_LIST);
    }
}
Also used : Context(android.content.Context) Bundle(android.os.Bundle) ApplicationInfo(android.content.pm.ApplicationInfo) Intent(android.content.Intent) PackageManagerWrapperImpl(com.android.settings.applications.PackageManagerWrapperImpl) NetworkTemplate(android.net.NetworkTemplate) UidDetail(com.android.settingslib.net.UidDetail) PackageManager(android.content.pm.PackageManager) AppItem(com.android.settingslib.AppItem) RemoteException(android.os.RemoteException) UidDetailProvider(com.android.settingslib.net.UidDetailProvider)

Example 10 with UidDetail

use of com.android.settingslib.net.UidDetail in project platform_packages_apps_Settings by BlissRoms.

the class AppDataUsage method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mPackageManagerWrapper = new PackageManagerWrapperImpl(getPackageManager());
    final Bundle args = getArguments();
    try {
        mStatsSession = services.mStatsService.openSession();
    } catch (RemoteException e) {
        throw new RuntimeException(e);
    }
    mAppItem = (args != null) ? (AppItem) args.getParcelable(ARG_APP_ITEM) : null;
    mTemplate = (args != null) ? (NetworkTemplate) args.getParcelable(ARG_NETWORK_TEMPLATE) : null;
    if (mTemplate == null) {
        Context context = getContext();
        mTemplate = DataUsageUtils.getDefaultTemplate(context, DataUsageUtils.getDefaultSubscriptionId(context));
    }
    if (mAppItem == null) {
        int uid = (args != null) ? args.getInt(AppInfoBase.ARG_PACKAGE_UID, -1) : getActivity().getIntent().getIntExtra(AppInfoBase.ARG_PACKAGE_UID, -1);
        if (uid == -1) {
            // TODO: Log error.
            getActivity().finish();
        } else {
            addUid(uid);
            mAppItem = new AppItem(uid);
            mAppItem.addUid(uid);
        }
    } else {
        for (int i = 0; i < mAppItem.uids.size(); i++) {
            addUid(mAppItem.uids.keyAt(i));
        }
    }
    addPreferencesFromResource(R.xml.app_data_usage);
    mTotalUsage = findPreference(KEY_TOTAL_USAGE);
    mForegroundUsage = findPreference(KEY_FOREGROUND_USAGE);
    mBackgroundUsage = findPreference(KEY_BACKGROUND_USAGE);
    mCycle = (SpinnerPreference) findPreference(KEY_CYCLE);
    mCycleAdapter = new CycleAdapter(getContext(), mCycle, mCycleListener, false);
    if (mAppItem.key > 0) {
        if (mPackages.size() != 0) {
            try {
                ApplicationInfo info = mPackageManagerWrapper.getApplicationInfoAsUser(mPackages.valueAt(0), 0, UserHandle.getUserId(mAppItem.key));
                mIcon = IconDrawableFactory.newInstance(getActivity()).getBadgedIcon(info);
                mLabel = info.loadLabel(mPackageManagerWrapper.getPackageManager());
                mPackageName = info.packageName;
            } catch (PackageManager.NameNotFoundException e) {
            }
        }
        if (!UserHandle.isApp(mAppItem.key)) {
            removePreference(KEY_UNRESTRICTED_DATA);
            removePreference(KEY_RESTRICT_BACKGROUND);
        } else {
            mRestrictBackground = (SwitchPreference) findPreference(KEY_RESTRICT_BACKGROUND);
            mRestrictBackground.setOnPreferenceChangeListener(this);
            mUnrestrictedData = (SwitchPreference) findPreference(KEY_UNRESTRICTED_DATA);
            mUnrestrictedData.setOnPreferenceChangeListener(this);
        }
        mDataSaverBackend = new DataSaverBackend(getContext());
        mAppSettings = findPreference(KEY_APP_SETTINGS);
        mAppSettingsIntent = new Intent(Intent.ACTION_MANAGE_NETWORK_USAGE);
        mAppSettingsIntent.addCategory(Intent.CATEGORY_DEFAULT);
        PackageManager pm = getPackageManager();
        boolean matchFound = false;
        for (String packageName : mPackages) {
            mAppSettingsIntent.setPackage(packageName);
            if (pm.resolveActivity(mAppSettingsIntent, 0) != null) {
                matchFound = true;
                break;
            }
        }
        if (!matchFound) {
            removePreference(KEY_APP_SETTINGS);
            mAppSettings = null;
        }
        if (mPackages.size() > 1) {
            mAppList = (PreferenceCategory) findPreference(KEY_APP_LIST);
            getLoaderManager().initLoader(LOADER_APP_PREF, Bundle.EMPTY, mAppPrefCallbacks);
        } else {
            removePreference(KEY_APP_LIST);
        }
    } else {
        final Context context = getActivity();
        UidDetail uidDetail = new UidDetailProvider(context).getUidDetail(mAppItem.key, true);
        mIcon = uidDetail.icon;
        mLabel = uidDetail.label;
        mPackageName = context.getPackageName();
        removePreference(KEY_UNRESTRICTED_DATA);
        removePreference(KEY_APP_SETTINGS);
        removePreference(KEY_RESTRICT_BACKGROUND);
        removePreference(KEY_APP_LIST);
    }
}
Also used : Context(android.content.Context) Bundle(android.os.Bundle) ApplicationInfo(android.content.pm.ApplicationInfo) Intent(android.content.Intent) PackageManagerWrapperImpl(com.android.settings.applications.PackageManagerWrapperImpl) NetworkTemplate(android.net.NetworkTemplate) UidDetail(com.android.settingslib.net.UidDetail) PackageManager(android.content.pm.PackageManager) AppItem(com.android.settingslib.AppItem) RemoteException(android.os.RemoteException) UidDetailProvider(com.android.settingslib.net.UidDetailProvider)

Aggregations

UidDetail (com.android.settingslib.net.UidDetail)13 Bundle (android.os.Bundle)11 AppItem (com.android.settingslib.AppItem)11 UidDetailProvider (com.android.settingslib.net.UidDetailProvider)11 Context (android.content.Context)7 Intent (android.content.Intent)7 ApplicationInfo (android.content.pm.ApplicationInfo)7 PackageManager (android.content.pm.PackageManager)7 NetworkTemplate (android.net.NetworkTemplate)7 RemoteException (android.os.RemoteException)5 PackageManagerWrapperImpl (com.android.settings.applications.PackageManagerWrapperImpl)5 FragmentActivity (androidx.fragment.app.FragmentActivity)4 Test (org.junit.Test)4 Config (org.robolectric.annotation.Config)3 ColorDrawable (android.graphics.drawable.ColorDrawable)2 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2