diff options
author | Adrian DC <radian.dc@gmail.com> | 2016-08-06 00:18:09 +0200 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2016-08-11 10:26:54 -0700 |
commit | 3afcbcf7153e554f09657845aaa2f8164d13d7e7 (patch) | |
tree | e07b344984dc676e20721f32b767a0eb49a725c9 /src | |
parent | 830a8464a067c022227344c95738bfe9e53fc526 (diff) | |
download | packages_apps_Settings-3afcbcf7153e554f09657845aaa2f8164d13d7e7.zip packages_apps_Settings-3afcbcf7153e554f09657845aaa2f8164d13d7e7.tar.gz packages_apps_Settings-3afcbcf7153e554f09657845aaa2f8164d13d7e7.tar.bz2 |
Settings: Show only one tab on PrivacyGuard direct access
* Allow an intent request to a specific tab to be isolated,
giving access only to the expected settings
* "Apps started on boot" opens only Bootup
* "Manage root accesses" opens only Root Access
* Related to the following commits
Ia5bc9d56fb11700b19d73336fad13c0a936091ff
I79d963ecbadc624dc45a398387a348691318b6be
Change-Id: I5a720fe2a8abe5fdf1a1b91c054d8b3a57d6cc5d
Signed-off-by: Adrian DC <radian.dc@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/applications/AppOpsSummary.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/settings/applications/AppOpsSummary.java b/src/com/android/settings/applications/AppOpsSummary.java index 31641e2..faefb65 100644 --- a/src/com/android/settings/applications/AppOpsSummary.java +++ b/src/com/android/settings/applications/AppOpsSummary.java @@ -65,6 +65,7 @@ public class AppOpsSummary extends InstrumentedFragment { CharSequence[] mPageNames; int mCurPos; + int mPositionOffset; @Override protected int getMetricsCategory() { @@ -81,12 +82,12 @@ public class AppOpsSummary extends InstrumentedFragment { @Override public Fragment getItem(int position) { - return new AppOpsCategory(mPageTemplates[position]); + return new AppOpsCategory(mPageTemplates[mPositionOffset + position]); } @Override public int getCount() { - return mPageTemplates.length; + return mPageNames.length; } @Override @@ -135,19 +136,22 @@ public class AppOpsSummary extends InstrumentedFragment { mPageNames = getResources().getTextArray(R.array.app_ops_categories_cm); - int defaultTab = -1; + mPositionOffset = 0; + + int specificTab = -1; Bundle bundle = getArguments(); if (bundle != null) { - defaultTab = Arrays.asList(mPageNames).indexOf(bundle.getString("appops_tab", "")); + specificTab = Arrays.asList(mPageNames).indexOf(bundle.getString("appops_tab", "")); + if (specificTab >= 0) { + mPageNames = Arrays.copyOfRange(mPageNames, specificTab, specificTab + 1); + mPositionOffset = specificTab; + } } mViewPager = (ViewPager) rootView.findViewById(R.id.pager); mAdapter = new MyPagerAdapter(getChildFragmentManager(), filterTemplates(AppOpsState.ALL_TEMPLATES)); mViewPager.setAdapter(mAdapter); - if (defaultTab >= 0) { - mViewPager.setCurrentItem(defaultTab); - } mViewPager.setOnPageChangeListener(mAdapter); PagerTabStrip tabs = (PagerTabStrip) rootView.findViewById(R.id.tabs); |