summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdnan <adnan@cyngn.com>2014-08-04 21:16:32 (GMT)
committerAdnan <adnan@cyngn.com>2014-08-04 21:17:12 (GMT)
commit35adb26e56973506eab6b0140da573072ca06a34 (patch)
tree58c3425fec65803a0187c7cdd5b8e3ff76d591b5
parent9b2529278d74e9ec2efcd94ed46d6b958d9161e0 (diff)
downloadandroid_packages_apps_Trebuchet-35adb26e56973506eab6b0140da573072ca06a34.zip
android_packages_apps_Trebuchet-35adb26e56973506eab6b0140da573072ca06a34.tar.gz
android_packages_apps_Trebuchet-35adb26e56973506eab6b0140da573072ca06a34.tar.bz2
Trebuchet: Don't show protected apps options in restricted profiles.
Change-Id: I6fb32d39e25150fdc65669c452784ab60e9f3115 JIRA: 4668 Issue: https://jira.cyanogenmod.org/browse/CYAN-4668
-rw-r--r--AndroidManifest.xml1
-rw-r--r--src/com/android/launcher3/OverviewSettingsPanel.java13
-rw-r--r--src/com/android/launcher3/Utilities.java6
3 files changed, 17 insertions, 3 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 830e2c4..222d20a 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -65,6 +65,7 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
+ <uses-permission android:name="android.permission.MANAGE_USERS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INJECT_EVENTS" />
<uses-permission android:name="android.permission.GET_TASKS"/>
diff --git a/src/com/android/launcher3/OverviewSettingsPanel.java b/src/com/android/launcher3/OverviewSettingsPanel.java
index e14b789..497e7ca 100644
--- a/src/com/android/launcher3/OverviewSettingsPanel.java
+++ b/src/com/android/launcher3/OverviewSettingsPanel.java
@@ -11,6 +11,9 @@ import android.widget.ListView;
import com.android.launcher3.list.PinnedHeaderListView;
import com.android.launcher3.list.SettingsPinnedHeaderAdapter;
+import java.util.ArrayList;
+import java.util.List;
+
public class OverviewSettingsPanel {
public static final String ANDROID_SETTINGS = "com.android.settings";
public static final String ANDROID_PROTECTED_APPS =
@@ -56,10 +59,14 @@ public class OverviewSettingsPanel {
res.getString(R.string.drawer_sorting_text),
res.getString(R.string.icon_labels)};
- String[] valuesApp = new String[] {
- res.getString(R.string.larger_icons_text),
- res.getString(R.string.protected_app_settings)};
+ List<String> valuesAppList = new ArrayList<String>();
+ valuesAppList.add(res.getString(R.string.larger_icons_text));
+ if (!Utilities.isRestrictedProfile(mLauncher)) {
+ valuesAppList.add(res.getString(R.string.protected_app_settings));
+ }
+ String[] valuesApp = new String[valuesAppList.size()];
+ valuesApp = valuesAppList.toArray(valuesApp);
mSettingsAdapter = new SettingsPinnedHeaderAdapter(mLauncher);
mSettingsAdapter.setHeaders(headers);
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index cbc9785..d1c5a0f 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -33,6 +33,7 @@ import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
+import android.os.UserManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
@@ -358,4 +359,9 @@ public final class Utilities {
"or use the exported attribute for this activity.", e);
}
}
+
+ public static boolean isRestrictedProfile(Context context) {
+ UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
+ return um.getUserInfo(um.getUserHandle()).isRestricted();
+ }
}