Java Code Examples for org.chromium.chrome.browser.preferences.PrefServiceBridge#isFirstRunEulaAccepted()
The following examples show how to use
org.chromium.chrome.browser.preferences.PrefServiceBridge#isFirstRunEulaAccepted() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FirstRunGlueImpl.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Synchronizes first run native and Java preferences. * Must be called after native initialization. */ public static void cacheFirstRunPrefs() { SharedPreferences javaPrefs = ContextUtils.getAppSharedPreferences(); PrefServiceBridge prefsBridge = PrefServiceBridge.getInstance(); // Set both Java and native prefs if any of the three indicators indicate ToS has been // accepted. This needed because: // - Old versions only set native pref, so this syncs Java pref. // - Backup & restore does not restore native pref, so this needs to update it. // - checkAnyUserHasSeenToS() may be true which needs to sync its state to the prefs. boolean javaPrefValue = javaPrefs.getBoolean(CACHED_TOS_ACCEPTED_PREF, false); boolean nativePrefValue = prefsBridge.isFirstRunEulaAccepted(); boolean userHasSeenTos = ToSAckedReceiver.checkAnyUserHasSeenToS(ContextUtils.getApplicationContext()); if (javaPrefValue || nativePrefValue || userHasSeenTos) { if (!javaPrefValue) { javaPrefs.edit().putBoolean(CACHED_TOS_ACCEPTED_PREF, true).apply(); } if (!nativePrefValue) { prefsBridge.setEulaAccepted(); } } }
Example 2
Source File: FirstRunGlueImpl.java From 365browser with Apache License 2.0 | 6 votes |
/** * Synchronizes first run native and Java preferences. * Must be called after native initialization. */ public static void cacheFirstRunPrefs() { SharedPreferences javaPrefs = ContextUtils.getAppSharedPreferences(); PrefServiceBridge prefsBridge = PrefServiceBridge.getInstance(); // Set both Java and native prefs if any of the three indicators indicate ToS has been // accepted. This needed because: // - Old versions only set native pref, so this syncs Java pref. // - Backup & restore does not restore native pref, so this needs to update it. // - checkAnyUserHasSeenToS() may be true which needs to sync its state to the prefs. boolean javaPrefValue = javaPrefs.getBoolean(CACHED_TOS_ACCEPTED_PREF, false); boolean nativePrefValue = prefsBridge.isFirstRunEulaAccepted(); boolean userHasSeenTos = ToSAckedReceiver.checkAnyUserHasSeenToS(ContextUtils.getApplicationContext()); boolean isFirstRunComplete = FirstRunStatus.getFirstRunFlowComplete(); if (javaPrefValue || nativePrefValue || userHasSeenTos || isFirstRunComplete) { if (!javaPrefValue) { javaPrefs.edit().putBoolean(CACHED_TOS_ACCEPTED_PREF, true).apply(); } if (!nativePrefValue) { prefsBridge.setEulaAccepted(); } } }