diff options
| author | Daniel Sandler <dsandler@android.com> | 2020-06-25 14:34:52 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-06-25 14:34:52 +0000 |
| commit | fc86cfb5bd9eb08ac09c6dc7c2e11abfd388483f (patch) | |
| tree | 3657fac170d1ba4063010dbe9a929de9e01ac104 /core/java | |
| parent | b3f5a7a9fe0e8306f09da493c590bd119caa466e (diff) | |
| parent | f4e83e0a4acd548bf1edd02bb845931a60bdb8da (diff) | |
Merge "Fixed bug: Not everyone has home controls yet, or pets." into rvc-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/app/PlatLogoActivity.java | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java index 2a7eae626795..986bbc8628ec 100644 --- a/core/java/com/android/internal/app/PlatLogoActivity.java +++ b/core/java/com/android/internal/app/PlatLogoActivity.java @@ -55,6 +55,10 @@ import org.json.JSONObject; public class PlatLogoActivity extends Activity { private static final boolean WRITE_SETTINGS = true; + private static final String R_EGG_UNLOCK_SETTING = "egg_mode_r"; + + private static final int UNLOCK_TRIES = 3; + BigDialView mDialView; @Override @@ -77,8 +81,10 @@ public class PlatLogoActivity extends Activity { mDialView = new BigDialView(this, null); if (Settings.System.getLong(getContentResolver(), - "egg_mode" /* Settings.System.EGG_MODE */, 0) == 0) { - mDialView.setUnlockTries(3); + R_EGG_UNLOCK_SETTING, 0) == 0) { + mDialView.setUnlockTries(UNLOCK_TRIES); + } else { + mDialView.setUnlockTries(0); } final FrameLayout layout = new FrameLayout(this); @@ -91,18 +97,16 @@ public class PlatLogoActivity extends Activity { private void launchNextStage(boolean locked) { final ContentResolver cr = getContentResolver(); - if (Settings.System.getLong(cr, "egg_mode" /* Settings.System.EGG_MODE */, 0) == 0) { - // For posterity: the moment this user unlocked the easter egg - try { - if (WRITE_SETTINGS) { - Settings.System.putLong(cr, - "egg_mode", // Settings.System.EGG_MODE, - locked ? 0 : System.currentTimeMillis()); - } - } catch (RuntimeException e) { - Log.e("com.android.internal.app.PlatLogoActivity", "Can't write settings", e); + try { + if (WRITE_SETTINGS) { + Settings.System.putLong(cr, + R_EGG_UNLOCK_SETTING, + locked ? 0 : System.currentTimeMillis()); } + } catch (RuntimeException e) { + Log.e("com.android.internal.app.PlatLogoActivity", "Can't write settings", e); } + try { startActivity(new Intent(Intent.ACTION_MAIN) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK @@ -235,8 +239,8 @@ public class PlatLogoActivity extends Activity { } return true; case MotionEvent.ACTION_UP: - if (mWasLocked && !mDialDrawable.isLocked()) { - launchNextStage(false); + if (mWasLocked != mDialDrawable.isLocked()) { + launchNextStage(mDialDrawable.isLocked()); } return true; } @@ -404,6 +408,8 @@ public class PlatLogoActivity extends Activity { if (isLocked() && oldUserLevel != STEPS - 1 && getUserLevel() == STEPS - 1) { mUnlockTries--; + } else if (!isLocked() && getUserLevel() == 0) { + mUnlockTries = UNLOCK_TRIES; } if (!isLocked()) { |
