<commit_before>package im.actor.core.utils;

import im.actor.core.AndroidMessenger;
import im.actor.runtime.Log;
import im.actor.runtime.actors.Actor;

public class AppStateActor extends Actor {

    private static final String TAG = "AppStateActor";

    private static final int CLOSE_TIMEOUT = 1000;

    private final AndroidMessenger messenger;

    private boolean isAppOpen = false;
    private boolean isScreenVisible = true;
    private int activityCount = 0;

    public AppStateActor(AndroidMessenger messenger) {
        this.messenger = messenger;
    }

    private void onActivityOpened() {
        Log.d(TAG, "onActivityOpened");
        activityCount++;
        if (isScreenVisible) {
            onAppProbablyOpened();
        }
    }

    private void onActivityClosed() {
        Log.d(TAG, "onActivityClosed");
        activityCount--;

        if (activityCount == 0) {
            onAppProbablyClosed();
        }
    }<commit_msg>fix(android): too long close timeout<commit_after>package im.actor.core.utils;

import im.actor.core.AndroidMessenger;
import im.actor.runtime.Log;
import im.actor.runtime.actors.Actor;

public class AppStateActor extends Actor {

    private static final String TAG = "AppStateActor";

    private static final int CLOSE_TIMEOUT = 100;

    private final AndroidMessenger messenger;

    private boolean isAppOpen = false;
    private boolean isScreenVisible = true;
    private int activityCount = 0;

    public AppStateActor(AndroidMessenger messenger) {
        this.messenger = messenger;
    }

    private void onActivityOpened() {
        Log.d(TAG, "onActivityOpened");
        activityCount++;
        if (isScreenVisible) {
            onAppProbablyOpened();
        }
    }

    private void onActivityClosed() {
        Log.d(TAG, "onActivityClosed");
        activityCount--;

        if (activityCount == 0) {
            onAppProbablyClosed();
        }
    }
{'fraction_non_alphanumeric': 0.08963730569948186, 'fraction_numerical': 0.005699481865284974, 'mean_word_length': 2.7641325536062378, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3525547', 'n_tokens_mistral': 573, 'n_tokens_neox': 516, 'n_words': 134}