Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: mobile/android/base/BrowserApp.java

Issue 29341330: Issue 3135 - Show the first run slide about the beta community to users that installed via Play and… (Closed)
Patch Set: Created May 12, 2016, 3:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mobile/android/thirdparty/org/adblockplus/browser/BrowserAppUtils.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public 2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 5
6 package org.mozilla.gecko; 6 package org.mozilla.gecko;
7 7
8 import org.mozilla.gecko.adjust.AdjustHelperInterface; 8 import org.mozilla.gecko.adjust.AdjustHelperInterface;
9 import org.mozilla.gecko.annotation.RobocopTarget; 9 import org.mozilla.gecko.annotation.RobocopTarget;
10 import org.mozilla.gecko.AdjustConstants; 10 import org.mozilla.gecko.AdjustConstants;
(...skipping 3540 matching lines...) Expand 10 before | Expand all | Expand 10 after
3551 3551
3552 // Faster on main thread with an async apply(). 3552 // Faster on main thread with an async apply().
3553 try { 3553 try {
3554 SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE); 3554 SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE);
3555 int launchCount = settings.getInt(keyName, 0); 3555 int launchCount = settings.getInt(keyName, 0);
3556 // In Adblock Browser, we only want to increment the feedback page 3556 // In Adblock Browser, we only want to increment the feedback page
3557 // launch count for release builds that were installed from the 3557 // launch count for release builds that were installed from the
3558 // Play store, see https://issues.adblockplus.org/ticket/2967 and 3558 // Play store, see https://issues.adblockplus.org/ticket/2967 and
3559 // https://issues.adblockplus.org/ticket/3136. 3559 // https://issues.adblockplus.org/ticket/3136.
3560 if (launchCount < FEEDBACK_LAUNCH_COUNT && 3560 if (launchCount < FEEDBACK_LAUNCH_COUNT &&
3561 AppConstants.ABB_RELEASE_BUILD && wasInstalledFromPlayStore()) { 3561 AppConstants.ABB_RELEASE_BUILD && org.adblockplus.browser.Browse rAppUtils.wasInstalledFromPlayStore(this)) {
anton 2016/09/12 11:36:11 what the point of using full classname with packag
diegocarloslima 2016/10/20 12:18:07 I agree with you that using an import + simple cla
3562 // Increment the launch count and store the new value. 3562 // Increment the launch count and store the new value.
3563 launchCount++; 3563 launchCount++;
3564 settings.edit().putInt(keyName, launchCount).apply(); 3564 settings.edit().putInt(keyName, launchCount).apply();
3565 3565
3566 // If we've reached our magic number, show the feedback page. 3566 // If we've reached our magic number, show the feedback page.
3567 if (launchCount == FEEDBACK_LAUNCH_COUNT) { 3567 if (launchCount == FEEDBACK_LAUNCH_COUNT) {
3568 GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEve nt("Feedback:Show", null)); 3568 GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEve nt("Feedback:Show", null));
3569 } 3569 }
3570 } 3570 }
3571 } finally { 3571 } finally {
3572 StrictMode.setThreadPolicy(savedPolicy); 3572 StrictMode.setThreadPolicy(savedPolicy);
3573 } 3573 }
3574 } 3574 }
3575 3575
3576 private boolean wasInstalledFromPlayStore() {
3577 final String installer = this.getPackageManager().getInstallerPackageNam e(this.getPackageName());
3578 return "com.android.vending".equals(installer);
3579 }
3580
3581 private void showTabQueuePromptIfApplicable(final Intent intent) { 3576 private void showTabQueuePromptIfApplicable(final Intent intent) {
3582 ThreadUtils.postToBackgroundThread(new Runnable() { 3577 ThreadUtils.postToBackgroundThread(new Runnable() {
3583 @Override 3578 @Override
3584 public void run() { 3579 public void run() {
3585 // We only want to show the prompt if the browser has been opene d from an external url 3580 // We only want to show the prompt if the browser has been opene d from an external url
3586 if (TabQueueHelper.TAB_QUEUE_ENABLED && mInitialized 3581 if (TabQueueHelper.TAB_QUEUE_ENABLED && mInitialized
3587 && Intent.ACTION_VIEW.equal s(intent.getAction()) 3582 && Intent.ACTION_VIEW.equal s(intent.getAction())
3588 && TabQueueHelper.shouldSho wTabQueuePrompt(BrowserApp.this)) { 3583 && TabQueueHelper.shouldSho wTabQueuePrompt(BrowserApp.this)) {
3589 Intent promptIntent = new Intent(BrowserApp.this, TabQueuePr ompt.class); 3584 Intent promptIntent = new Intent(BrowserApp.this, TabQueuePr ompt.class);
3590 startActivityForResult(promptIntent, ACTIVITY_REQUEST_TAB_QU EUE); 3585 startActivityForResult(promptIntent, ACTIVITY_REQUEST_TAB_QU EUE);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
3810 final boolean inGuestMode = GeckoProfile.get(this).inGuestMode(); 3805 final boolean inGuestMode = GeckoProfile.get(this).inGuestMode();
3811 if (inGuestMode) { 3806 if (inGuestMode) {
3812 return StartupAction.GUEST; 3807 return StartupAction.GUEST;
3813 } 3808 }
3814 if (RestrictedProfiles.isRestrictedProfile(this)) { 3809 if (RestrictedProfiles.isRestrictedProfile(this)) {
3815 return StartupAction.RESTRICTED; 3810 return StartupAction.RESTRICTED;
3816 } 3811 }
3817 return (passedURL == null ? StartupAction.NORMAL : StartupAction.URL); 3812 return (passedURL == null ? StartupAction.NORMAL : StartupAction.URL);
3818 } 3813 }
3819 } 3814 }
OLDNEW
« no previous file with comments | « no previous file | mobile/android/thirdparty/org/adblockplus/browser/BrowserAppUtils.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld