Java Code Examples for org.chromium.base.ApplicationStatus#unregisterApplicationStateListener()

The following examples show how to use org.chromium.base.ApplicationStatus#unregisterApplicationStateListener() . 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: LifecycleHook.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Reset static singletons.
 * This is needed for JUnit tests as statics are not reset between runs and previous states can
 * make other tests fail. It is not needed in instrumentation tests (and will be removed by
 * Proguard in release builds) since the application lifecycle will naturally do the work.
 */
public static void destroyInstanceForJUnitTests() {
    LifecycleHook hook;
    synchronized (sInstanceLock) {
        if (sInstance == null) return;
        hook = sInstance;
        sInstance = null;
    }
    ApplicationStatus.unregisterApplicationStateListener(hook);
}
 
Example 2
Source File: AppBannerInfoBarDelegateAndroid.java    From delion with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private void destroy() {
    if (mInstallTask != null) {
        mInstallTask.cancel();
        mInstallTask = null;
    }
    ApplicationStatus.unregisterApplicationStateListener(mListener);
    mNativePointer = 0;
}
 
Example 3
Source File: WebApkInstaller.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void onInstallFinishedInternal(boolean success) {
    ApplicationStatus.unregisterApplicationStateListener(mListener);
    mInstallTask = null;
    if (mNativePointer != 0) {
        nativeOnInstallFinished(mNativePointer, success);
    }
    if (success && mIsInstall) {
        ShortcutHelper.addWebApkShortcut(ContextUtils.getApplicationContext(),
                mWebApkPackageName);
    }
}
 
Example 4
Source File: LifecycleHook.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Reset static singletons.
 * This is needed for JUnit tests as statics are not reset between runs and previous states can
 * make other tests fail. It is not needed in instrumentation tests (and will be removed by
 * Proguard in release builds) since the application lifecycle will naturally do the work.
 */
public static void destroyInstanceForJUnitTests() {
    LifecycleHook hook;
    synchronized (sInstanceLock) {
        if (sInstance == null) return;
        hook = sInstance;
        sInstance = null;
    }
    ApplicationStatus.unregisterApplicationStateListener(hook);
}
 
Example 5
Source File: AppBannerInfoBarDelegateAndroid.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private void destroy() {
    if (mInstallTask != null) {
        mInstallTask.cancel();
        mInstallTask = null;
    }
    ApplicationStatus.unregisterApplicationStateListener(mListener);
    mNativePointer = 0;
}
 
Example 6
Source File: LifecycleHook.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Reset static singletons.
 * This is needed for JUnit tests as statics are not reset between runs and previous states can
 * make other tests fail. It is not needed in instrumentation tests (and will be removed by
 * Proguard in release builds) since the application lifecycle will naturally do the work.
 */
public static void destroyInstanceForJUnitTests() {
    LifecycleHook hook;
    synchronized (sInstanceLock) {
        if (sInstance == null) return;
        hook = sInstance;
        sInstance = null;
    }
    ApplicationStatus.unregisterApplicationStateListener(hook);
}
 
Example 7
Source File: AppBannerInfoBarDelegateAndroid.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private void destroy() {
    if (mInstallTask != null) {
        mInstallTask.cancel();
        mInstallTask = null;
    }
    ApplicationStatus.unregisterApplicationStateListener(mListener);
    mNativePointer = 0;
}
 
Example 8
Source File: RegistrationPolicyApplicationStatus.java    From cronet with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected void destroy() {
    if (mDestroyed) return;
    ApplicationStatus.unregisterApplicationStateListener(this);
    mDestroyed = true;
}
 
Example 9
Source File: DefaultMediaRouteController.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Called when the main activity receives an onDestroy() call.
 */
protected void onActivitiesDestroyed() {
    ApplicationStatus.unregisterApplicationStateListener(mApplicationStateListener);
    release();
}
 
Example 10
Source File: WebApkInstaller.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@CalledByNative
private void destroy() {
    ApplicationStatus.unregisterApplicationStateListener(mListener);
    mNativePointer = 0;
}
 
Example 11
Source File: DefaultMediaRouteController.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Called when the main activity receives an onDestroy() call.
 */
protected void onActivitiesDestroyed() {
    ApplicationStatus.unregisterApplicationStateListener(mApplicationStateListener);
    release();
}
 
Example 12
Source File: DefaultMediaRouteController.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Called when the main activity receives an onDestroy() call.
 */
protected void onActivitiesDestroyed() {
    ApplicationStatus.unregisterApplicationStateListener(mApplicationStateListener);
    release();
}
 
Example 13
Source File: RegistrationPolicyApplicationStatus.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
protected void destroy() {
    if (mDestroyed) return;
    ApplicationStatus.unregisterApplicationStateListener(this);
    mDestroyed = true;
}