Search in sources :

Example 1 with UuidBasedUniqueIdentificationGenerator

use of org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator in project AndroidChromium by JackyAndroid.

the class ProcessInitializationHandler method handlePreNativeInitialization.

/**
     * Performs the shared class initialization.
     */
protected void handlePreNativeInitialization() {
    ChromeApplication application = (ChromeApplication) ContextUtils.getApplicationContext();
    UiUtils.setKeyboardShowingDelegate(new UiUtils.KeyboardShowingDelegate() {

        @Override
        public boolean disableKeyboardCheck(Context context, View view) {
            Activity activity = null;
            if (context instanceof Activity) {
                activity = (Activity) context;
            } else if (view != null && view.getContext() instanceof Activity) {
                activity = (Activity) view.getContext();
            }
            // For multiwindow mode we do not track keyboard visibility.
            return activity != null && MultiWindowUtils.getInstance().isLegacyMultiWindow(activity);
        }
    });
    // Initialize the AccountManagerHelper with the correct AccountManagerDelegate. Must be done
    // only once and before AccountMangerHelper.get(...) is called to avoid using the
    // default AccountManagerDelegate.
    AccountManagerHelper.initializeAccountManagerHelper(application, application.createAccountManagerDelegate());
    // Set the unique identification generator for invalidations.  The
    // invalidations system can start and attempt to fetch the client ID
    // very early.  We need this generator to be ready before that happens.
    UniqueIdInvalidationClientNameGenerator.doInitializeAndInstallGenerator(application);
    // Set minimum Tango log level. This sets an in-memory static field, and needs to be
    // set in the ApplicationContext instead of an activity, since Tango can be woken up
    // by the system directly though messages from GCM.
    AndroidLogger.setMinimumAndroidLogLevel(Log.WARN);
    // Set up the identification generator for sync. The ID is actually generated
    // in the SyncController constructor.
    UniqueIdentificationGeneratorFactory.registerGenerator(SyncController.GENERATOR_ID, new UuidBasedUniqueIdentificationGenerator(application, SESSIONS_UUID_PREF_KEY), false);
}
Also used : Context(android.content.Context) ChromeApplication(org.chromium.chrome.browser.ChromeApplication) UuidBasedUniqueIdentificationGenerator(org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator) Activity(android.app.Activity) View(android.view.View) UiUtils(org.chromium.ui.UiUtils)

Example 2 with UuidBasedUniqueIdentificationGenerator

use of org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator in project AndroidChromium by JackyAndroid.

the class UniqueIdInvalidationClientNameGenerator method doInitializeAndInstallGenerator.

/**
     * Called during early init to make this InvalidationClientNameGenerator the default.
     *
     * This should be called very early during initialization to setup the invalidaiton client name.
     */
public static void doInitializeAndInstallGenerator(Context context) {
    UniqueIdentificationGenerator idGenerator = new UuidBasedUniqueIdentificationGenerator(context, INVALIDATIONS_UUID_PREF_KEY);
    InvalidationClientNameGenerator clientNameGenerator = new UniqueIdInvalidationClientNameGenerator(idGenerator);
    InvalidationClientNameProvider.get().setPreferredClientNameGenerator(clientNameGenerator);
}
Also used : InvalidationClientNameGenerator(org.chromium.components.sync.notifier.InvalidationClientNameGenerator) UuidBasedUniqueIdentificationGenerator(org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator) UuidBasedUniqueIdentificationGenerator(org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator) UniqueIdentificationGenerator(org.chromium.chrome.browser.identity.UniqueIdentificationGenerator)

Aggregations

UuidBasedUniqueIdentificationGenerator (org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator)2 Activity (android.app.Activity)1 Context (android.content.Context)1 View (android.view.View)1 ChromeApplication (org.chromium.chrome.browser.ChromeApplication)1 UniqueIdentificationGenerator (org.chromium.chrome.browser.identity.UniqueIdentificationGenerator)1 InvalidationClientNameGenerator (org.chromium.components.sync.notifier.InvalidationClientNameGenerator)1 UiUtils (org.chromium.ui.UiUtils)1