diff options
author | Dave Tharp <dtharp@codeaurora.org> | 2015-05-20 15:25:07 -0700 |
---|---|---|
committer | WebTech Code Review <code-review@localhost> | 2015-05-21 10:47:36 -0700 |
commit | 3e2896f56b2e1893a9f559c1a64ef436da64e6fc (patch) | |
tree | 7b446884bd15ef24c66a52c14df9191b6d6deb63 /src/com/android/browser/NavScreen.java | |
parent | 60aac81798fd01c8aaa8b9aeae554416d6ca14f0 (diff) | |
download | android_packages_apps_Gello-3e2896f56b2e1893a9f559c1a64ef436da64e6fc.tar.gz android_packages_apps_Gello-3e2896f56b2e1893a9f559c1a64ef436da64e6fc.tar.bz2 android_packages_apps_Gello-3e2896f56b2e1893a9f559c1a64ef436da64e6fc.zip |
MDM Incognito Mode Restriction
Implements handling of MDM enforced restriction preventing the user
from opening an incognito tab.
When enforced by MDM, the Incognito button on the tabs screen
is greyed out, and if tapped, presents a toast message informing
the user that the setting is managed by the administrator.
This commit includes basic unit tests.
Change-Id: I26fcf10cc954f63c8e4489dbac9ff148e90b0c94
Diffstat (limited to 'src/com/android/browser/NavScreen.java')
-rw-r--r-- | src/com/android/browser/NavScreen.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/browser/NavScreen.java b/src/com/android/browser/NavScreen.java index 9e32f49c..76d0703f 100644 --- a/src/com/android/browser/NavScreen.java +++ b/src/com/android/browser/NavScreen.java @@ -33,8 +33,10 @@ import android.widget.LinearLayout; import android.widget.PopupMenu; import android.widget.PopupMenu.OnMenuItemClickListener; import android.widget.RelativeLayout; +import android.widget.Toast; import com.android.browser.NavTabScroller.OnRemoveListener; +import com.android.browser.mdm.IncognitoRestriction; import java.util.HashMap; @@ -107,12 +109,15 @@ public class NavScreen extends RelativeLayout mUiController.getTabControl().getTabPosition(mUi.getActiveTab())); } + + private void init() { LayoutInflater.from(getContext()).inflate(R.layout.nav_screen, this); setContentDescription(getContext().getResources().getString( R.string.accessibility_transition_navscreen)); mToolbarLayout = findViewById(R.id.nav_toolbar_animate); mNewIncognitoTab = (ImageButton) findViewById(R.id.newincognitotab); + IncognitoRestriction.getInstance().registerButton(mNewIncognitoTab); mNewTab = (ImageButton) findViewById(R.id.newtab); mMore = (ImageButton) findViewById(R.id.more); mNewIncognitoTab.setOnClickListener(this); @@ -144,7 +149,11 @@ public class NavScreen extends RelativeLayout if (mNewTab == v) { openNewTab(); } else if (mNewIncognitoTab == v) { - openNewIncognitoTab(); + if (IncognitoRestriction.getInstance().isEnabled()) { + Toast.makeText(getContext(), R.string.mdm_managed_alert, Toast.LENGTH_SHORT).show(); + } else { + openNewIncognitoTab(); + } } else if (mMore == v) { showPopupMenu(); } |