Example usage for android.content Intent EXTRA_RESTRICTIONS_LIST

List of usage examples for android.content Intent EXTRA_RESTRICTIONS_LIST

Introduction

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

Prototype

String EXTRA_RESTRICTIONS_LIST

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

Click Source Link

Document

Extra used in the response from a BroadcastReceiver that handles #ACTION_GET_RESTRICTION_ENTRIES .

Usage

From source file:com.android.tv.settings.users.AppRestrictionsFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    AppRestrictionsPreference pref = (AppRestrictionsPreference) findPreference(
            mCustomRequestMap.get(requestCode));
    if (pref == null) {
        Log.w(TAG, "Unknown requestCode " + requestCode);
        return;//ww w . j a  va2 s  .  c  om
    }

    if (resultCode == Activity.RESULT_OK) {
        String packageName = getPackageFromKey(pref.getKey());
        ArrayList<RestrictionEntry> list = data.getParcelableArrayListExtra(Intent.EXTRA_RESTRICTIONS_LIST);
        Bundle bundle = data.getBundleExtra(Intent.EXTRA_RESTRICTIONS_BUNDLE);
        if (list != null) {
            // If there's a valid result, persist it to the user manager.
            pref.setRestrictions(list);
            mUserManager.setApplicationRestrictions(packageName,
                    RestrictionsManager.convertRestrictionsToBundle(list), mUser);
        } else if (bundle != null) {
            // If there's a valid result, persist it to the user manager.
            mUserManager.setApplicationRestrictions(packageName, bundle, mUser);
        }
    }
    // Remove request from the map
    mCustomRequestMap.remove(requestCode);
}