Example usage for android.content Intent ACTION_MANAGE_PACKAGE_STORAGE

List of usage examples for android.content Intent ACTION_MANAGE_PACKAGE_STORAGE

Introduction

In this page you can find the example usage for android.content Intent ACTION_MANAGE_PACKAGE_STORAGE.

Prototype

String ACTION_MANAGE_PACKAGE_STORAGE

To view the source code for android.content Intent ACTION_MANAGE_PACKAGE_STORAGE.

Click Source Link

Document

Broadcast Action: Indicates low memory condition notification acknowledged by user and package management should be started.

Usage

From source file:com.android.settings.applications.CanBeOnSdCardChecker.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setHasOptionsMenu(true);//  ww  w . j  a  va2s.co  m

    mApplicationsState = ApplicationsState.getInstance(getActivity().getApplication());
    Intent intent = getActivity().getIntent();
    String action = intent.getAction();
    int defaultListType = LIST_TYPE_DOWNLOADED;
    String className = getArguments() != null ? getArguments().getString("classname") : null;
    if (className == null) {
        className = intent.getComponent().getClassName();
    }
    if (className.equals(RunningServicesActivity.class.getName()) || className.endsWith(".RunningServices")) {
        defaultListType = LIST_TYPE_RUNNING;
    } else if (className.equals(StorageUseActivity.class.getName())
            || Intent.ACTION_MANAGE_PACKAGE_STORAGE.equals(action) || className.endsWith(".StorageUse")) {
        mSortOrder = SORT_ORDER_SIZE;
        defaultListType = LIST_TYPE_ALL;
    } else if (Settings.ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS.equals(action)) {
        // Select the all-apps list, with the default sorting
        defaultListType = LIST_TYPE_ALL;
    }

    if (savedInstanceState != null) {
        mSortOrder = savedInstanceState.getInt(EXTRA_SORT_ORDER, mSortOrder);
        int tmp = savedInstanceState.getInt(EXTRA_DEFAULT_LIST_TYPE, -1);
        if (tmp != -1)
            defaultListType = tmp;
        mShowBackground = savedInstanceState.getBoolean(EXTRA_SHOW_BACKGROUND, false);
    }

    mDefaultListType = defaultListType;

    final Intent containerIntent = new Intent().setComponent(StorageMeasurement.DEFAULT_CONTAINER_COMPONENT);
    getActivity().bindService(containerIntent, mContainerConnection, Context.BIND_AUTO_CREATE);

    mInvalidSizeStr = getActivity().getText(R.string.invalid_size_value);
    mComputingSizeStr = getActivity().getText(R.string.computing_size);

    TabInfo tab = new TabInfo(this, mApplicationsState,
            getActivity().getString(R.string.filter_apps_third_party), LIST_TYPE_DOWNLOADED, this,
            savedInstanceState);
    mTabs.add(tab);

    if (!Environment.isExternalStorageEmulated()) {
        tab = new TabInfo(this, mApplicationsState, getActivity().getString(R.string.filter_apps_onsdcard),
                LIST_TYPE_SDCARD, this, savedInstanceState);
        mTabs.add(tab);
    }

    tab = new TabInfo(this, mApplicationsState, getActivity().getString(R.string.filter_apps_running),
            LIST_TYPE_RUNNING, this, savedInstanceState);
    mTabs.add(tab);

    tab = new TabInfo(this, mApplicationsState, getActivity().getString(R.string.filter_apps_all),
            LIST_TYPE_ALL, this, savedInstanceState);
    mTabs.add(tab);

    tab = new TabInfo(this, mApplicationsState, getActivity().getString(R.string.filter_apps_disabled),
            LIST_TYPE_DISABLED, this, savedInstanceState);
    mTabs.add(tab);

    mNumTabs = mTabs.size();
}