Merge "Add AppRestrictions sample to new repository" into jb-mr2-dev
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/build.gradle b/content/multiuser/AppRestrictions/AppRestrictions/build.gradle
new file mode 100644
index 0000000..b461fdf
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/build.gradle
@@ -0,0 +1,14 @@
+buildscript {
+    repositories {
+        mavenCentral()
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:0.5.+'
+    }
+}
+apply plugin: 'android'
+
+android {
+    compileSdkVersion 18
+    buildToolsVersion "17.0.0"
+}
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/AndroidManifest.xml b/content/multiuser/AppRestrictions/AppRestrictions/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..dd9fc09
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/AndroidManifest.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          android:versionCode="1"
+          android:versionName="1"
+          package="com.example.android.apprestrictions">
+
+    <uses-sdk android:minSdkVersion="18" />
+
+    <application android:label="@string/app_name"
+                 android:icon="@drawable/ic_launcher">
+
+        <activity android:name="MainActivity"
+                  android:label="@string/app_name" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name="CustomRestrictionsActivity"
+                  android:label="@string/restrictions_activity_label" />
+
+        <receiver android:name="GetRestrictionsReceiver">
+            <intent-filter>
+                <action android:name="android.intent.action.GET_RESTRICTION_ENTRIES" />
+            </intent-filter>
+        </receiver>
+    </application>
+</manifest>
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/CustomRestrictionsActivity.java b/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/CustomRestrictionsActivity.java
new file mode 100644
index 0000000..213b313
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/CustomRestrictionsActivity.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apprestrictions;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+/**
+ * This activity demonstrates how an app can integrate its own custom app restriction settings
+ * with the restricted profile feature.
+ *
+ * This sample app maintains custom app restriction settings in shared preferences.  When
+ * the activity is invoked (from Settings > Users), the stored settings are used to initialize
+ * the custom configuration on the user interface.  Three sample input types are
+ * shown: checkbox, single-choice, and multi-choice.  When the settings are modified by the user,
+ * the corresponding restriction entries are saved, which are retrievable under a restricted
+ * profile.
+ */
+public class CustomRestrictionsActivity extends Activity {
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        if (savedInstanceState == null) {
+            getFragmentManager().beginTransaction().replace(android.R.id.content,
+                    new CustomRestrictionsFragment()).commit();
+        }
+    }
+}
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/CustomRestrictionsFragment.java b/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/CustomRestrictionsFragment.java
new file mode 100644
index 0000000..b04dfd1
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/CustomRestrictionsFragment.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apprestrictions;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.RestrictionEntry;
+import android.os.Bundle;
+import android.os.UserManager;
+import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
+import android.preference.MultiSelectListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceFragment;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * This fragment is included in {@code CustomRestrictionsActivity}.  It demonstrates how an app
+ * can integrate its own custom app restriction settings with the restricted profile feature.
+ *
+ * This sample app maintains custom app restriction settings in shared preferences.  Your app
+ * can use other methods to maintain the settings.  When this activity is invoked
+ * (from Settings > Users > Restricted Profile), the shared preferences are used to initialize
+ * the custom configuration on the user interface.
+ *
+ * Three sample input types are shown: checkbox, single-choice, and multi-choice.  When the
+ * settings are modified by the user, the corresponding restriction entries are saved in the
+ * platform.  The saved restriction entries are retrievable when the app is launched under a
+ * restricted profile.
+ */
+public class CustomRestrictionsFragment extends PreferenceFragment
+        implements Preference.OnPreferenceChangeListener {
+
+    // Shared preference key for the boolean restriction.
+    private static final String KEY_BOOLEAN_PREF = "pref_boolean";
+    // Shared preference key for the single-select restriction.
+    private static final String KEY_CHOICE_PREF = "pref_choice";
+    // Shared preference key for the multi-select restriction.
+    private static final String KEY_MULTI_PREF = "pref_multi";
+
+
+    private List<RestrictionEntry> mRestrictions;
+    private Bundle mRestrictionsBundle;
+
+    // Shared preferences for each of the sample input types.
+    private CheckBoxPreference mBooleanPref;
+    private ListPreference mChoicePref;
+    private MultiSelectListPreference mMultiPref;
+
+    // Restriction entries for each of the sample input types.
+    private RestrictionEntry mBooleanEntry;
+    private RestrictionEntry mChoiceEntry;
+    private RestrictionEntry mMultiEntry;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        addPreferencesFromResource(R.xml.custom_prefs);
+
+        // This sample app uses shared preferences to maintain app restriction settings.  Your app
+        // can use other methods to maintain the settings.
+        mBooleanPref = (CheckBoxPreference) findPreference(KEY_BOOLEAN_PREF);
+        mChoicePref = (ListPreference) findPreference(KEY_CHOICE_PREF);
+        mMultiPref = (MultiSelectListPreference) findPreference(KEY_MULTI_PREF);
+
+        mBooleanPref.setOnPreferenceChangeListener(this);
+        mChoicePref.setOnPreferenceChangeListener(this);
+        mMultiPref.setOnPreferenceChangeListener(this);
+
+        setRetainInstance(true);
+    }
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+        final Activity activity = getActivity();
+
+        // BEGIN_INCLUDE (GET_CURRENT_RESTRICTIONS)
+        // Existing app restriction settings, if exist, can be retrieved from the Bundle.
+        mRestrictionsBundle =
+                activity.getIntent().getBundleExtra(Intent.EXTRA_RESTRICTIONS_BUNDLE);
+
+        if (mRestrictionsBundle == null) {
+            mRestrictionsBundle =
+                    ((UserManager) activity.getSystemService(Context.USER_SERVICE))
+                            .getApplicationRestrictions(activity.getPackageName());
+        }
+
+        if (mRestrictionsBundle == null) {
+            mRestrictionsBundle = new Bundle();
+        }
+
+        mRestrictions = activity.getIntent().getParcelableArrayListExtra(
+                Intent.EXTRA_RESTRICTIONS_LIST);
+        // END_INCLUDE (GET_CURRENT_RESTRICTIONS)
+
+        // Transfers the saved values into the preference hierarchy.
+        if (mRestrictions != null) {
+            for (RestrictionEntry entry : mRestrictions) {
+                if (entry.getKey().equals(GetRestrictionsReceiver.KEY_BOOLEAN)) {
+                    mBooleanPref.setChecked(entry.getSelectedState());
+                    mBooleanEntry = entry;
+                } else if (entry.getKey().equals(GetRestrictionsReceiver.KEY_CHOICE)) {
+                    mChoicePref.setValue(entry.getSelectedString());
+                    mChoiceEntry = entry;
+                } else if (entry.getKey().equals(GetRestrictionsReceiver.KEY_MULTI_SELECT)) {
+                    HashSet<String> set = new HashSet<String>();
+                    for (String value : entry.getAllSelectedStrings()) {
+                        set.add(value);
+                    }
+                    mMultiPref.setValues(set);
+                    mMultiEntry = entry;
+                }
+            }
+        } else {
+            mRestrictions = new ArrayList<RestrictionEntry>();
+
+            // Initializes the boolean restriction entry and updates its corresponding shared
+            // preference value.
+            mBooleanEntry = new RestrictionEntry(GetRestrictionsReceiver.KEY_BOOLEAN,
+                    mRestrictionsBundle.getBoolean(GetRestrictionsReceiver.KEY_BOOLEAN, false));
+            mBooleanEntry.setType(RestrictionEntry.TYPE_BOOLEAN);
+            mBooleanPref.setChecked(mBooleanEntry.getSelectedState());
+
+            // Initializes the single choice restriction entry and updates its corresponding
+            // shared preference value.
+            mChoiceEntry = new RestrictionEntry(GetRestrictionsReceiver.KEY_CHOICE,
+                    mRestrictionsBundle.getString(GetRestrictionsReceiver.KEY_CHOICE));
+            mChoiceEntry.setType(RestrictionEntry.TYPE_CHOICE);
+            mChoicePref.setValue(mChoiceEntry.getSelectedString());
+
+            // Initializes the multi-select restriction entry and updates its corresponding
+            // shared preference value.
+            mMultiEntry = new RestrictionEntry(GetRestrictionsReceiver.KEY_MULTI_SELECT,
+                    mRestrictionsBundle.getStringArray(
+                            GetRestrictionsReceiver.KEY_MULTI_SELECT));
+            mMultiEntry.setType(RestrictionEntry.TYPE_MULTI_SELECT);
+            if (mMultiEntry.getAllSelectedStrings() != null) {
+                HashSet<String> set = new HashSet<String>();
+                final String[] values = mRestrictionsBundle.getStringArray(
+                        GetRestrictionsReceiver.KEY_MULTI_SELECT);
+                if (values != null) {
+                    for (String value : values) {
+                        set.add(value);
+                    }
+                }
+                mMultiPref.setValues(set);
+            }
+            mRestrictions.add(mBooleanEntry);
+            mRestrictions.add(mChoiceEntry);
+            mRestrictions.add(mMultiEntry);
+        }
+        // Prepares result to be passed back to the Settings app when the custom restrictions
+        // activity finishes.
+        Intent intent = new Intent(getActivity().getIntent());
+        intent.putParcelableArrayListExtra(Intent.EXTRA_RESTRICTIONS_LIST,
+                new ArrayList<RestrictionEntry>(mRestrictions));
+        getActivity().setResult(Activity.RESULT_OK, intent);
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        if (preference == mBooleanPref) {
+            mBooleanEntry.setSelectedState((Boolean) newValue);
+        } else if (preference == mChoicePref) {
+            mChoiceEntry.setSelectedString((String) newValue);
+        } else if (preference == mMultiPref) {
+            String[] selectedStrings = new String[((Set<String>)newValue).size()];
+            int i = 0;
+            for (String value : (Set<String>) newValue) {
+                selectedStrings[i++] = value;
+            }
+            mMultiEntry.setAllSelectedStrings(selectedStrings);
+        }
+
+        // Saves all the app restriction configuration changes from the custom activity.
+        Intent intent = new Intent(getActivity().getIntent());
+        intent.putParcelableArrayListExtra(Intent.EXTRA_RESTRICTIONS_LIST,
+                new ArrayList<RestrictionEntry>(mRestrictions));
+        getActivity().setResult(Activity.RESULT_OK, intent);
+        return true;
+    }
+}
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/GetRestrictionsReceiver.java b/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/GetRestrictionsReceiver.java
new file mode 100644
index 0000000..bb5a283
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/GetRestrictionsReceiver.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apprestrictions;
+
+import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.RestrictionEntry;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.util.Log;
+
+import java.util.ArrayList;
+
+public class GetRestrictionsReceiver extends BroadcastReceiver {
+    private static final String TAG = GetRestrictionsReceiver.class.getSimpleName();
+
+    // Keys for referencing app restriction settings from the platform.
+    public static final String KEY_BOOLEAN = "boolean_key";
+    public static final String KEY_CHOICE = "choice_key";
+    public static final String KEY_MULTI_SELECT = "multi_key";
+
+    @Override
+    public void onReceive(final Context context, Intent intent) {
+        final PendingResult result = goAsync();
+
+        // If app restriction settings are already created, they will be included in the Bundle
+        // as key/value pairs.
+        final Bundle existingRestrictions =
+                intent.getBundleExtra(Intent.EXTRA_RESTRICTIONS_BUNDLE);
+        Log.i(TAG, "existingRestrictions = " + existingRestrictions);
+
+        new Thread() {
+            public void run() {
+                createRestrictions(context, result, existingRestrictions);
+            }
+        }.start();
+    }
+
+    // Initializes a boolean type restriction entry.
+    public static void populateBooleanEntry(Resources res, RestrictionEntry entry) {
+        entry.setType(RestrictionEntry.TYPE_BOOLEAN);
+        entry.setTitle(res.getString(R.string.boolean_entry_title));
+    }
+
+    // Initializes a single choice type restriction entry.
+    public static void populateChoiceEntry(Resources res, RestrictionEntry reSingleChoice) {
+        String[] choiceEntries = res.getStringArray(R.array.choice_entry_entries);
+        String[] choiceValues = res.getStringArray(R.array.choice_entry_values);
+        if (reSingleChoice.getSelectedString() == null) {
+            reSingleChoice.setSelectedString(choiceValues[0]);
+        }
+        reSingleChoice.setTitle(res.getString(R.string.choice_entry_title));
+        reSingleChoice.setChoiceEntries(choiceEntries);
+        reSingleChoice.setChoiceValues(choiceValues);
+        reSingleChoice.setType(RestrictionEntry.TYPE_CHOICE);
+    }
+
+    // Initializes a multi-select type restriction entry.
+    public static void populateMultiEntry(Resources res, RestrictionEntry reMultiSelect) {
+        String[] multiEntries = res.getStringArray(R.array.multi_entry_entries);
+        String[] multiValues = res.getStringArray(R.array.multi_entry_values);
+        if (reMultiSelect.getAllSelectedStrings() == null) {
+            reMultiSelect.setAllSelectedStrings(new String[0]);
+        }
+        reMultiSelect.setTitle(res.getString(R.string.multi_entry_title));
+        reMultiSelect.setChoiceEntries(multiEntries);
+        reMultiSelect.setChoiceValues(multiValues);
+        reMultiSelect.setType(RestrictionEntry.TYPE_MULTI_SELECT);
+    }
+
+    // Demonstrates the creation of standard app restriction types: boolean, single choice, and
+    // multi-select.
+    private ArrayList<RestrictionEntry> initRestrictions(Context context) {
+        ArrayList<RestrictionEntry> newRestrictions = new ArrayList<RestrictionEntry>();
+        Resources res = context.getResources();
+
+        RestrictionEntry reBoolean = new RestrictionEntry(KEY_BOOLEAN, false);
+        populateBooleanEntry(res, reBoolean);
+        newRestrictions.add(reBoolean);
+
+        RestrictionEntry reSingleChoice = new RestrictionEntry(KEY_CHOICE, (String) null);
+        populateChoiceEntry(res, reSingleChoice);
+        newRestrictions.add(reSingleChoice);
+
+        RestrictionEntry reMultiSelect = new RestrictionEntry(KEY_MULTI_SELECT, (String[]) null);
+        populateMultiEntry(res, reMultiSelect);
+        newRestrictions.add(reMultiSelect);
+
+        return newRestrictions;
+    }
+
+    private void createRestrictions(Context context, PendingResult result,
+                                    Bundle existingRestrictions) {
+        // The incoming restrictions bundle contains key/value pairs representing existing app
+        // restrictions for this package. In order to retain existing app restrictions, you need to
+        // construct new restriction entries and then copy in any existing values for the new keys.
+        ArrayList<RestrictionEntry> newEntries = initRestrictions(context);
+
+        // If app restrictions were not previously configured for the package, create the default
+        // restrictions entries and return them.
+        if (existingRestrictions == null) {
+            Bundle extras = new Bundle();
+            extras.putParcelableArrayList(Intent.EXTRA_RESTRICTIONS_LIST, newEntries);
+            result.setResult(Activity.RESULT_OK, null, extras);
+            result.finish();
+            return;
+        }
+
+        // Retains current restriction settings by transferring existing restriction entries to
+        // new ones.
+        for (RestrictionEntry entry : newEntries) {
+            final String key = entry.getKey();
+            if (KEY_BOOLEAN.equals(key)) {
+                entry.setSelectedState(existingRestrictions.getBoolean(KEY_BOOLEAN));
+            } else if (KEY_CHOICE.equals(key)) {
+                if (existingRestrictions.containsKey(KEY_CHOICE)) {
+                    entry.setSelectedString(existingRestrictions.getString(KEY_CHOICE));
+                }
+            } else if (KEY_MULTI_SELECT.equals(key)) {
+                if (existingRestrictions.containsKey(KEY_MULTI_SELECT)) {
+                    entry.setAllSelectedStrings(existingRestrictions.getStringArray(key));
+                }
+            }
+        }
+
+        final Bundle extras = new Bundle();
+
+        // This path demonstrates the use of a custom app restriction activity instead of standard
+        // types.  When a custom activity is set, the standard types will not be available under
+        // app restriction settings.
+        //
+        // If your app has an existing activity for app restriction configuration, you can set it
+        // up with the intent here.
+        if (PreferenceManager.getDefaultSharedPreferences(context)
+                .getBoolean(MainActivity.CUSTOM_CONFIG_KEY, false)) {
+            final Intent customIntent = new Intent();
+            customIntent.setClass(context, CustomRestrictionsActivity.class);
+            extras.putParcelable(Intent.EXTRA_RESTRICTIONS_INTENT, customIntent);
+        }
+
+        extras.putParcelableArrayList(Intent.EXTRA_RESTRICTIONS_LIST, newEntries);
+        result.setResult(Activity.RESULT_OK, null, extras);
+        result.finish();
+    }
+}
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/MainActivity.java b/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/MainActivity.java
new file mode 100644
index 0000000..57c4439
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/java/com/example/android/apprestrictions/MainActivity.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apprestrictions;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.os.UserManager;
+import android.preference.PreferenceManager;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.TextView;
+
+/**
+ * This is the main user interface of the App Restrictions sample app.  It demonstrates the use
+ * of the App Restriction feature, which is available on Android 4.3 and above tablet devices
+ * with the multiuser feature.
+ *
+ * When launched under the primary User account, you can toggle between standard app restriction
+ * types and custom.  When launched under a restricted profile, this activity displays app
+ * restriction settings, if available.
+ *
+ * Follow these steps to exercise the feature:
+ * 1. If this is the primary user, go to Settings > Users.
+ * 2. Create a restricted profile, if one doesn't exist already.
+ * 3. Open the profile settings, locate the sample app, and tap the app restriction settings
+ *    icon. Configure app restrictions for the app.
+ * 4. In the lock screen, switch to the user's restricted profile, launch this sample app,
+ *    and see the configured app restrictions displayed.
+ */
+public class MainActivity extends Activity {
+    private Bundle mRestrictionsBundle;
+
+    // Checkbox to indicate whether custom or standard app restriction types are selected.
+    private CheckBox mCustomConfig;
+
+    public static final String CUSTOM_CONFIG_KEY = "custom_config";
+
+    private TextView mMultiEntryValue;
+    private TextView mChoiceEntryValue;
+    private TextView mBooleanEntryValue;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // Sets up  user interface elements.
+        setContentView(R.layout.main);
+
+        mCustomConfig = (CheckBox) findViewById(R.id.custom_app_limits);
+        final boolean customChecked =
+                PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
+                        CUSTOM_CONFIG_KEY, false);
+        if (customChecked) mCustomConfig.setChecked(true);
+
+        mMultiEntryValue = (TextView) findViewById(R.id.multi_entry_id);
+        mChoiceEntryValue = (TextView) findViewById(R.id.choice_entry_id);
+        mBooleanEntryValue = (TextView) findViewById(R.id.boolean_entry_id);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+
+        // If app restrictions are set for this package, when launched from a restricted profile,
+        // the settings are available in the returned Bundle as key/value pairs.
+        mRestrictionsBundle =
+                ((UserManager) getSystemService(Context.USER_SERVICE))
+                        .getApplicationRestrictions(getPackageName());
+        if (mRestrictionsBundle == null) {
+            mRestrictionsBundle = new Bundle();
+        }
+
+        // Reads and displays values from a boolean type restriction entry, if available.
+        // An app can utilize these settings to restrict its content under a restricted profile.
+        final String booleanRestrictionValue =
+                mRestrictionsBundle.containsKey(GetRestrictionsReceiver.KEY_BOOLEAN) ?
+                        mRestrictionsBundle.getBoolean(GetRestrictionsReceiver.KEY_BOOLEAN) + "":
+                        getString(R.string.na);
+        mBooleanEntryValue.setText(booleanRestrictionValue);
+
+        // Reads and displays values from a single choice restriction entry, if available.
+        final String singleChoiceRestrictionValue =
+                mRestrictionsBundle.containsKey(GetRestrictionsReceiver.KEY_CHOICE) ?
+                        mRestrictionsBundle.getString(GetRestrictionsReceiver.KEY_CHOICE) :
+                        getString(R.string.na);
+        mChoiceEntryValue.setText(singleChoiceRestrictionValue);
+
+        // Reads and displays values from a multi-select restriction entry, if available.
+        final String[] multiSelectValues =
+                mRestrictionsBundle.getStringArray(GetRestrictionsReceiver.KEY_MULTI_SELECT);
+        if (multiSelectValues == null || multiSelectValues.length == 0) {
+            mMultiEntryValue.setText(getString(R.string.na));
+        } else {
+            String tempValue = "";
+            for (String value : multiSelectValues) {
+                tempValue = tempValue + value + " ";
+            }
+            mMultiEntryValue.setText(tempValue);
+        }
+    }
+
+    /**
+     * Saves custom app restriction to the shared preference.
+     *
+     * This flag is used by {@code GetRestrictionsReceiver} to determine if a custom app
+     * restriction activity should be used.
+     *
+     * @param view
+     */
+    public void onCustomClicked(View view) {
+        final SharedPreferences.Editor editor =
+                PreferenceManager.getDefaultSharedPreferences(this).edit();
+        editor.putBoolean(CUSTOM_CONFIG_KEY, mCustomConfig.isChecked()).commit();
+    }
+}
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-hdpi/ic_launcher.png b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 0000000..f36c473
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-mdpi/ic_launcher.png b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 0000000..5ab2e0d
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-xhdpi/ic_launcher.png b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 0000000..7622838
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-xxhdpi/ic_launcher.png b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 0000000..7f55fef
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/layout/main.xml b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/layout/main.xml
new file mode 100644
index 0000000..55e2c8e
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/layout/main.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
+    <LinearLayout android:orientation="vertical"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_margin="20dp">
+
+        <TextView android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:layout_marginBottom="10dp"
+                  android:textSize="18sp"
+                  android:text="@string/sample_app_description"/>
+
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_marginBottom="15dp">
+            <CheckBox android:id="@+id/custom_app_limits"
+                      android:layout_width="wrap_content"
+                      android:layout_height="wrap_content"
+                      android:onClick="onCustomClicked"/>
+            <TextView android:layout_width="wrap_content"
+                      android:layout_height="wrap_content"
+                      android:textSize="18sp"
+                      android:text="@string/custom_description"
+                      android:onClick="onCustomClicked"
+                      android:layout_weight="1"/>
+        </LinearLayout>
+
+        <!-- Separator -->
+        <View android:layout_height="1dp"
+               android:background="@android:color/white"
+               android:layout_width="match_parent"
+               android:layout_margin="25dp"/>
+
+        <!-- Section to show app restriction settings under a restricted profile. -->
+        <TextView android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:textSize="20sp"
+                  android:text="@string/current_app_limits_label"/>
+        <TextView android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:textSize="18sp"
+                  android:layout_marginBottom="10dp"
+                  android:text="@string/current_app_limits_description"/>
+
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_marginLeft="20dp">
+            <TextView android:layout_width="210dp"
+                      android:layout_height="wrap_content"
+                      android:textSize="18sp"
+                      android:text="@string/boolean_entry_title"/>
+            <Space android:layout_height="1dp"
+                   android:layout_width="15dp"/>
+            <TextView android:id="@+id/boolean_entry_id"
+                      android:layout_width="wrap_content"
+                      android:layout_height="wrap_content"
+                      android:textSize="18sp"
+                      android:text="@string/boolean_entry_title"/>
+        </LinearLayout>
+
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_marginLeft="20dp">
+            <TextView android:layout_width="210dp"
+                      android:layout_height="wrap_content"
+                      android:textSize="18sp"
+                      android:text="@string/choice_entry_title"/>
+            <Space android:layout_height="1dp"
+                   android:layout_width="15dp"/>
+            <TextView android:id="@+id/choice_entry_id"
+                      android:layout_width="wrap_content"
+                      android:layout_height="wrap_content"
+                      android:textSize="18sp"
+                      android:text="@string/boolean_entry_title"/>
+        </LinearLayout>
+
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_marginLeft="20dp">
+            <TextView android:layout_width="210dp"
+                      android:layout_height="wrap_content"
+                      android:textSize="18sp"
+                      android:text="@string/multi_entry_title"/>
+            <Space android:layout_height="1dp"
+                   android:layout_width="15dp"/>
+            <TextView android:id="@+id/multi_entry_id"
+                      android:layout_width="wrap_content"
+                      android:layout_height="wrap_content"
+                      android:textSize="18sp"
+                      android:text="@string/multi_entry_title"/>
+        </LinearLayout>
+    </LinearLayout>
+</ScrollView>
\ No newline at end of file
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/values/strings.xml b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/values/strings.xml
new file mode 100644
index 0000000..2dac3b1
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/values/strings.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <string name="app_name">App Restrictions Demo</string>
+    <string name="restrictions_activity_label">Custom app restrictions</string>
+    <string name="boolean_entry_title">Test boolean type</string>
+    <string name="choice_entry_title">Test choice type</string>
+    <string name="multi_entry_title">Test multi-select type</string>
+    <string name="custom_description">If checked, use a custom app restriction Activity.  Otherwise,
+        use standard restriction types.
+    </string>
+    <string name="sample_app_description">Note: This sample app requires the restricted profile
+        feature.\n\n
+        1. If this is the primary user, go to Settings &gt; Users.\n\n
+        2. Create a restricted profile, if one doesn\'t exist already.\n\n
+        3. Open the profile settings, locate the sample app, and tap the app restriction settings
+        icon. Configure app restrictions for the app.\n\n
+        4. In the lock screen, switch to the user\'s restricted profile, launch this sample app,
+        and see the configured app restrictions displayed.\n
+    </string>
+    <string name="settings_button_label">Go to Settings</string>
+    <string name="current_app_limits_label">Current app restriction settings:</string>
+    <string name="na">N/A</string>
+    <string name="current_app_limits_description">Your app can restrict its content based on these
+        settings, which can be configured through the primary user\'s Users Settings.
+    </string>
+
+    <string-array name="multi_entry_entries">
+        <item>Ice Cream</item>
+        <item>Jelly Bean</item>
+        <item>More Jelly Bean</item>
+    </string-array>
+
+    <string-array name="multi_entry_values" translateable="false">
+        <item>1</item>
+        <item>2</item>
+        <item>3</item>
+    </string-array>
+
+    <string-array name="choice_entry_entries">
+        <item>Ice Cream</item>
+        <item>Jelly Bean</item>
+        <item>More Jelly Bean</item>
+    </string-array>
+
+    <string-array name="choice_entry_values" translateable="false">
+        <item>1</item>
+        <item>2</item>
+        <item>3</item>
+    </string-array>
+
+</resources>
\ No newline at end of file
diff --git a/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/xml/custom_prefs.xml b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/xml/custom_prefs.xml
new file mode 100644
index 0000000..5a3cf0d
--- /dev/null
+++ b/content/multiuser/AppRestrictions/AppRestrictions/src/main/res/xml/custom_prefs.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        android:title="@string/restrictions_activity_label">
+
+    <CheckBoxPreference android:key="pref_boolean"
+        android:title="@string/boolean_entry_title" />
+
+    <ListPreference android:key="pref_choice"
+        android:title="@string/choice_entry_title"
+        android:entries="@array/choice_entry_entries"
+        android:entryValues="@array/choice_entry_values" />
+
+    <MultiSelectListPreference android:key="pref_multi"
+        android:title="@string/multi_entry_title"
+        android:entries="@array/multi_entry_entries"
+        android:entryValues="@array/multi_entry_values" />
+
+</PreferenceScreen>
diff --git a/content/multiuser/AppRestrictions/build.gradle b/content/multiuser/AppRestrictions/build.gradle
new file mode 100644
index 0000000..495c503
--- /dev/null
+++ b/content/multiuser/AppRestrictions/build.gradle
@@ -0,0 +1 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
diff --git a/content/multiuser/AppRestrictions/gradle/wrapper/gradle-wrapper.jar b/content/multiuser/AppRestrictions/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
--- /dev/null
+++ b/content/multiuser/AppRestrictions/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/content/multiuser/AppRestrictions/gradle/wrapper/gradle-wrapper.properties b/content/multiuser/AppRestrictions/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..5c22dec
--- /dev/null
+++ b/content/multiuser/AppRestrictions/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 10 15:27:10 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
diff --git a/content/multiuser/AppRestrictions/gradlew b/content/multiuser/AppRestrictions/gradlew
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/content/multiuser/AppRestrictions/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+    echo "$*"
+}
+
+die ( ) {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+    JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/content/multiuser/AppRestrictions/gradlew.bat b/content/multiuser/AppRestrictions/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/content/multiuser/AppRestrictions/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off

+@rem ##########################################################################

+@rem

+@rem  Gradle startup script for Windows

+@rem

+@rem ##########################################################################

+

+@rem Set local scope for the variables with windows NT shell

+if "%OS%"=="Windows_NT" setlocal

+

+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.

+set DEFAULT_JVM_OPTS=

+

+set DIRNAME=%~dp0

+if "%DIRNAME%" == "" set DIRNAME=.

+set APP_BASE_NAME=%~n0

+set APP_HOME=%DIRNAME%

+

+@rem Find java.exe

+if defined JAVA_HOME goto findJavaFromJavaHome

+

+set JAVA_EXE=java.exe

+%JAVA_EXE% -version >NUL 2>&1

+if "%ERRORLEVEL%" == "0" goto init

+

+echo.

+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

+echo.

+echo Please set the JAVA_HOME variable in your environment to match the

+echo location of your Java installation.

+

+goto fail

+

+:findJavaFromJavaHome

+set JAVA_HOME=%JAVA_HOME:"=%

+set JAVA_EXE=%JAVA_HOME%/bin/java.exe

+

+if exist "%JAVA_EXE%" goto init

+

+echo.

+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%

+echo.

+echo Please set the JAVA_HOME variable in your environment to match the

+echo location of your Java installation.

+

+goto fail

+

+:init

+@rem Get command-line arguments, handling Windowz variants

+

+if not "%OS%" == "Windows_NT" goto win9xME_args

+if "%@eval[2+2]" == "4" goto 4NT_args

+

+:win9xME_args

+@rem Slurp the command line arguments.

+set CMD_LINE_ARGS=

+set _SKIP=2

+

+:win9xME_args_slurp

+if "x%~1" == "x" goto execute

+

+set CMD_LINE_ARGS=%*

+goto execute

+

+:4NT_args

+@rem Get arguments from the 4NT Shell from JP Software

+set CMD_LINE_ARGS=%$

+

+:execute

+@rem Setup the command line

+

+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

+

+@rem Execute Gradle

+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

+

+:end

+@rem End local scope for the variables with windows NT shell

+if "%ERRORLEVEL%"=="0" goto mainEnd

+

+:fail

+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of

+rem the _cmd.exe /c_ return code!

+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1

+exit /b 1

+

+:mainEnd

+if "%OS%"=="Windows_NT" endlocal

+

+:omega

diff --git a/content/multiuser/AppRestrictions/settings.gradle b/content/multiuser/AppRestrictions/settings.gradle
new file mode 100644
index 0000000..41f2d03
--- /dev/null
+++ b/content/multiuser/AppRestrictions/settings.gradle
@@ -0,0 +1 @@
+include ':AppRestrictions'