diff options
author | Kamaljeet Maini <kmaini@cyngn.com> | 2016-05-10 16:25:17 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-05-16 13:06:38 -0700 |
commit | d10f6950c4321409d35476b934f09241b4a1b345 (patch) | |
tree | 028e55f71321233acf3bf1d7fbbdfee147500c1b /src/com/android/settings/applications | |
parent | a44bfb5a396056e22825f4989eee47b90b7bbc14 (diff) | |
download | packages_apps_Settings-d10f6950c4321409d35476b934f09241b4a1b345.zip packages_apps_Settings-d10f6950c4321409d35476b934f09241b4a1b345.tar.gz packages_apps_Settings-d10f6950c4321409d35476b934f09241b4a1b345.tar.bz2 |
Close "Protected apps" activity during power cycle
Protected apps activity in Settings is accessed after entering
correct pattern. If user turns off/on the phone while Protected
apps is in foreground, the user must enter pattern again before
using the Protected apps.
Added code in onPause method to close the Protected apps activity
if the user has already been authorized and there is no screen
orientation change.
Change-Id: Ie36ac0f54cce62228f6d0d56fef2e1f24096a803
Issue-Id: FEIJ-491
Diffstat (limited to 'src/com/android/settings/applications')
-rw-r--r-- | src/com/android/settings/applications/ProtectedAppsActivity.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/com/android/settings/applications/ProtectedAppsActivity.java b/src/com/android/settings/applications/ProtectedAppsActivity.java index 5089f19..7156c92 100644 --- a/src/com/android/settings/applications/ProtectedAppsActivity.java +++ b/src/com/android/settings/applications/ProtectedAppsActivity.java @@ -72,6 +72,7 @@ public class ProtectedAppsActivity extends Activity { private boolean mWaitUserAuth = false; private boolean mUserIsAuth = false; private Intent mTargetIntent; + private int mOrientation; private HashSet<ComponentName> mProtectedApps = new HashSet<ComponentName>(); @@ -105,6 +106,7 @@ public class ProtectedAppsActivity extends Activity { } else { if (!mUserIsAuth) { // Require unlock + mWaitUserAuth = true; Intent lockPattern = new Intent(this, LockPatternActivity.class); startActivityForResult(lockPattern, REQ_ENTER_PATTERN); } else { @@ -114,6 +116,7 @@ public class ProtectedAppsActivity extends Activity { } } } + mOrientation = getResources().getConfiguration().orientation; } @Override @@ -167,8 +170,10 @@ public class ProtectedAppsActivity extends Activity { public void onPause() { super.onPause(); - // Don't stick around - if (mWaitUserAuth && !mUserIsAuth) { + // Close this app to prevent unauthorized access when + // 1) not waiting for authorization and + // 2) there is no portrait/landscape mode switching + if (!mWaitUserAuth && (mOrientation == getResources().getConfiguration().orientation)) { finish(); } } @@ -181,7 +186,7 @@ public class ProtectedAppsActivity extends Activity { protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case REQ_ENTER_PATTERN: - mWaitUserAuth = true; + mWaitUserAuth = false; switch (resultCode) { case RESULT_OK: //Nothing to do, proceed! @@ -197,7 +202,7 @@ public class ProtectedAppsActivity extends Activity { } break; case REQ_RESET_PATTERN: - mWaitUserAuth = true; + mWaitUserAuth = false; mUserIsAuth = false; } } @@ -244,7 +249,7 @@ public class ProtectedAppsActivity extends Activity { } private void resetLock() { - mWaitUserAuth = false; + mWaitUserAuth = true; Intent lockPattern = new Intent(LockPatternActivity.RECREATE_PATTERN, null, this, LockPatternActivity.class); startActivityForResult(lockPattern, REQ_RESET_PATTERN); |