package com.ifpdos.factorytest;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.provider.Settings;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.LinearLayout;
import com.ifpdos.Utils.ToastUtils;
import com.ifpdos.Utils.UdiUtil;
import com.ifpdos.Utils.okhttp.OkHttpHelper;
import com.ifpdos.factorytest.ConfigParser;
import com.ifpdos.factorytest.entity.EmptyBody;
import com.ifpdos.factorytest.receiver.USBReceiver;
import com.ifpdos.factorytest.udi.ConnectModeEnum;
import com.ifpdos.factorytest.util.FileUtil;
import com.ifpdos.factorytest.util.SensorUtil;
import com.ifpdos.factorytest.util.SourceUtil;
import com.ifpdos.factorytest.util.TxbUtil;
import com.ifpdos.factorytest.util.WiredNetworkUtil;
import com.ifpdos.mcusdk.McuSDK;
import com.ifpdos.mcusdk.interfaces.OnSdkConnected;
import com.seewo.sdk.SDKPictureHelper;
import com.seewo.sdk.model.SDKUSBSource;
import com.seewo.vcommons.constants.SeewoIntent;
import com.seewo.vcommons.data.PreferencesUtils;
import com.seewo.vcommons.data.PropertiesUtils;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;
import io.reactivex.schedulers.Schedulers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

/* JADX INFO: loaded from: classes.dex */
public class MainTestActivity extends Activity implements ActivityRecreator {
    static final int AUTOMATIC_TEST_REQUEST = 100000;
    private static final int CELL_ROWS = 4;
    private static final int DEFAULT_DENSITY = 160;
    private static final int MSG_COPY_COMPLETE = 1;
    private static final String NTP_SERVER = "ntp_server";
    static final String TAG = "MainTestActivity";
    private static long lastClickTime = 0;
    static int mDensity = 160;
    static int mTestMode;
    private Disposable dis;
    int mCellWidth;
    private View.OnClickListener mClickListener;
    LinearLayout mRoot;
    LinearLayout[] mRowContainer;
    int mRows;
    private SourceUtil mSourceUtil;
    public String mTagNo;
    public String mTagTesting;
    public String mTagYes;
    private OnTestDoneListener mTestDoneListener;
    TestItem[] mTestItems;
    public TestItem mTestingItem;
    private String orgHumanDetectionSensitivity;
    private String orgNtpServer;
    private Boolean orgTxbEnable;
    ProgressDialog mProgressDialog = null;
    private boolean mWaitTest = false;
    private boolean initReady = false;
    private boolean closeInkResult = false;
    private USBReceiver usbReceiver = new USBReceiver();
    private ExecutorService executor = Executors.newSingleThreadExecutor();
    public int orgWifiUsbSource = 5;
    private boolean orgAutoLight = false;
    public boolean mKillApp = true;
    private boolean oriEthernetEnable = true;
    private ConnectModeEnum oriEthernetMode = ConnectModeEnum.DHCP;
    private Handler mHandler = new Handler(Looper.getMainLooper(), new Handler.Callback() { // from class: com.ifpdos.factorytest.MainTestActivity$$ExternalSyntheticLambda4
        @Override // android.os.Handler.Callback
        public final boolean handleMessage(Message message) {
            return this.f$0.lambda$new$0(message);
        }
    });

    public static int dip(int i) {
        int i2 = mDensity;
        return i2 == 160 ? i : (i * i2) / 160;
    }

    public static int undip(int i) {
        int i2 = mDensity;
        return i2 == 160 ? i : (i * 160) / i2;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ boolean lambda$new$0(Message message) {
        if (message.what != 1) {
            return false;
        }
        this.mProgressDialog.dismiss();
        showUi();
        showLoadLastResult();
        startService(new Intent(this, (Class<?>) FloatNavbarService.class));
        this.initReady = true;
        return false;
    }

    private void loadContentViewDelay() {
        showProgressDialog();
        this.executor.submit(new Runnable() { // from class: com.ifpdos.factorytest.MainTestActivity$$ExternalSyntheticLambda3
            @Override // java.lang.Runnable
            public final void run() {
                this.f$0.lambda$loadContentViewDelay$1();
            }
        });
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ void lambda$loadContentViewDelay$1() {
        FileUtil.copyDftConfig();
        this.mHandler.sendEmptyMessage(1);
    }

    private void showProgressDialog() {
        ProgressDialog progressDialog = new ProgressDialog(this);
        this.mProgressDialog = progressDialog;
        progressDialog.setMessage(getString(R.string.initializing));
        this.mProgressDialog.setCancelable(false);
        this.mProgressDialog.show();
    }

    public static boolean isFastDoubleClick() {
        long jCurrentTimeMillis = System.currentTimeMillis();
        long j = jCurrentTimeMillis - lastClickTime;
        if (j > 0 && j < 500) {
            Log.d(TAG, "isFastDoubleClick true");
            return true;
        }
        lastClickTime = jCurrentTimeMillis;
        return false;
    }

    @Override // android.app.Activity
    public void onCreate(Bundle bundle) {
        Log.d(TAG, "onCreate: setLanguage");
        LanguageHelper.INSTANCE.setLanguage(this);
        super.onCreate(bundle);
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.hardware.usb.action.USB_DEVICE_ATTACHED");
        registerReceiver(this.usbReceiver, intentFilter);
        requestWindowFeature(1);
        initSwitchStatus();
        loadContentViewDelay();
        int i = 0;
        if (PropertiesUtils.getProperty("persist.sys.ir_touch_pens_num", 0) > 0) {
            this.dis = Observable.interval(0L, 1L, TimeUnit.SECONDS).filter(new Predicate() { // from class: com.ifpdos.factorytest.MainTestActivity$$ExternalSyntheticLambda0
                @Override // io.reactivex.functions.Predicate
                public final boolean test(Object obj) {
                    return this.f$0.lambda$onCreate$2((Long) obj);
                }
            }).takeUntil(new Predicate() { // from class: com.ifpdos.factorytest.MainTestActivity$$ExternalSyntheticLambda1
                @Override // io.reactivex.functions.Predicate
                public final boolean test(Object obj) {
                    return this.f$0.lambda$onCreate$3((Long) obj);
                }
            }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer() { // from class: com.ifpdos.factorytest.MainTestActivity$$ExternalSyntheticLambda2
                @Override // io.reactivex.functions.Consumer
                public final void accept(Object obj) throws Exception {
                    this.f$0.lambda$onCreate$4((Long) obj);
                }
            });
        }
        mDensity = (int) (getResources().getDisplayMetrics().density * 160.0f);
        int iUndip = undip(getResources().getDisplayMetrics().heightPixels);
        int iUndip2 = undip(getResources().getDisplayMetrics().widthPixels);
        Log.d(TAG, "screenHeight=" + iUndip + ", screenWidth=" + iUndip2 + ", mDensity=" + mDensity);
        if (iUndip2 < 200) {
            finish();
            return;
        }
        if (mDensity == 160) {
            ConfigParameter.mTitleTextSize = 20;
            ConfigParameter.mResultTextSize = 16;
            ConfigParameter.mStatusTextSize = 12;
        } else {
            ConfigParameter.mTitleTextSize = 16;
            ConfigParameter.mResultTextSize = 14;
            ConfigParameter.mStatusTextSize = 10;
        }
        this.mTagYes = getResources().getString(R.string.yes);
        this.mTagNo = getResources().getString(R.string.no);
        this.mTagTesting = getResources().getString(R.string.testing);
        this.mRows = 4;
        this.mCellWidth = iUndip2 / 4;
        this.mClickListener = new View.OnClickListener() { // from class: com.ifpdos.factorytest.MainTestActivity.1
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                if (MainTestActivity.isFastDoubleClick()) {
                    return;
                }
                if (MainTestActivity.this.mWaitTest) {
                    MainTestActivity mainTestActivity = MainTestActivity.this;
                    new AskDialog(mainTestActivity, true, mainTestActivity.mTagYes, false, null, MainTestActivity.this.mTestingItem.getTitle() + MainTestActivity.this.mTagTesting, null, null);
                    return;
                }
                Log.d(MainTestActivity.TAG, view.toString());
                MainTestActivity.this.mTestingItem = (TestItem) view;
                if (MainTestActivity.this.mTestingItem.mTested) {
                    MainTestActivity mainTestActivity2 = MainTestActivity.this;
                    mainTestActivity2.mWaitTest = mainTestActivity2.mTestingItem.retest();
                } else {
                    MainTestActivity mainTestActivity3 = MainTestActivity.this;
                    mainTestActivity3.mWaitTest = mainTestActivity3.mTestingItem.doTest();
                }
            }
        };
        this.mTestDoneListener = new OnTestDoneListener() { // from class: com.ifpdos.factorytest.MainTestActivity.2
            @Override // com.ifpdos.factorytest.OnTestDoneListener
            public void onTestDone(View view, ConfigParser.IDS ids, boolean z, String str) {
                if (((TestItem) view) == MainTestActivity.this.mTestingItem) {
                    MainTestActivity.this.mWaitTest = false;
                }
            }
        };
        ArrayList<TestItem> config = ConfigParser.parseConfig(this, mTestMode);
        TestItem[] testItemArr = new TestItem[config.size()];
        this.mTestItems = testItemArr;
        this.mTestItems = (TestItem[]) config.toArray(testItemArr);
        while (true) {
            TestItem[] testItemArr2 = this.mTestItems;
            if (i >= testItemArr2.length) {
                return;
            }
            testItemArr2[i].setOnClickListener(this.mClickListener);
            this.mTestItems[i].setOnTestDoneListener(this.mTestDoneListener);
            i++;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ boolean lambda$onCreate$2(Long l) throws Exception {
        this.closeInkResult = closeInk().booleanValue();
        Log.e(TAG, "关闭Ink: " + this.closeInkResult + " x=" + l);
        return l.longValue() == 3 || this.closeInkResult;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ boolean lambda$onCreate$3(Long l) throws Exception {
        return l.longValue() == 3 || this.closeInkResult;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ void lambda$onCreate$4(Long l) throws Exception {
        if (this.closeInkResult) {
            ToastUtils.showToast(this, R.string.closeInk_toast_success);
        } else {
            ToastUtils.showToast(this, R.string.closeInk_toast_fail);
        }
    }

    private void initSwitchStatus() {
        String humanDetectionSensitivity = SensorUtil.getHumanDetectionSensitivity();
        this.orgHumanDetectionSensitivity = humanDetectionSensitivity;
        if (!humanDetectionSensitivity.equals("FACTORY") && !SensorUtil.setHumanDetectionSensitivity("FACTORY")) {
            Log.e(TAG, "set human detection sensitivity factory fail");
        }
        if (ConfigParser.hasRKPTest()) {
            this.orgNtpServer = Settings.Global.getString(getContentResolver(), NTP_SERVER);
            Settings.Global.putString(getContentResolver(), NTP_SERVER, "cn.pool.ntp.org");
            Log.d(TAG, "initSwitchStatus: orgNtpServer = " + this.orgNtpServer + "getNewNtpServer: " + Settings.Global.getString(getContentResolver(), NTP_SERVER));
        }
        this.orgTxbEnable = Boolean.valueOf(TxbUtil.isTxbEnable());
        Log.d(TAG, "initSwitchStatus: orgTxbEnable = " + this.orgTxbEnable);
        if (!this.orgTxbEnable.booleanValue()) {
            TxbUtil.setTxbEnable(true);
        }
        boolean ethernetEnable = WiredNetworkUtil.getEthernetEnable(this);
        this.oriEthernetEnable = ethernetEnable;
        if (!ethernetEnable) {
            WiredNetworkUtil.setEthernetEnable(this, true);
        }
        ConnectModeEnum ethernetMode = WiredNetworkUtil.getEthernetMode(this);
        this.oriEthernetMode = ethernetMode;
        if (ethernetMode == ConnectModeEnum.MANUAL) {
            WiredNetworkUtil.setEthernetMode(this, ConnectModeEnum.DHCP);
        }
        Log.d(TAG, "initEnvironment: set settings AUTO_TIME and AUTO_TIME_ZONE to 1");
        Settings.Global.putInt(getContentResolver(), "auto_time", 1);
        Settings.Global.putInt(getContentResolver(), "auto_time_zone", 1);
        this.orgAutoLight = SDKPictureHelper.I.isAutoLightEnabled();
        this.mSourceUtil = new SourceUtil();
        this.orgWifiUsbSource = PreferencesUtils.getWifiUSB(getApplicationContext());
        McuSDK.getInstance().connect(this, new OnSdkConnected() { // from class: com.ifpdos.factorytest.MainTestActivity.3
            @Override // com.ifpdos.mcusdk.interfaces.OnSdkConnected
            public void onSdkConnected() {
                Log.d(MainTestActivity.TAG, "McuSDK connect success");
                MainTestActivity.this.mSourceUtil.SwitchWifiUsbSource(MainTestActivity.this.getApplicationContext(), SDKUSBSource.ANDROID);
                Log.d(MainTestActivity.TAG, "onSdkConnected: set wifi usb to android:" + SDKUSBSource.ANDROID);
            }

            @Override // com.ifpdos.mcusdk.interfaces.OnSdkConnected
            public void onSDKDisconnect() {
                Log.d(MainTestActivity.TAG, "McuSDK onSDKDisconnect");
            }
        });
    }

    private void restoreSwitchStatus() {
        SensorUtil.setHumanDetectionSensitivity(this.orgHumanDetectionSensitivity);
        if (ConfigParser.hasRKPTest()) {
            Settings.Global.putString(getContentResolver(), NTP_SERVER, this.orgNtpServer);
            Log.d(TAG, "restoreSwitchStatus: set orgNtpServer = " + this.orgNtpServer + "getNewNtpServer: " + Settings.Global.getString(getContentResolver(), NTP_SERVER));
        }
        if (this.orgWifiUsbSource != PreferencesUtils.getWifiUSB(this)) {
            SourceUtil sourceUtil = new SourceUtil();
            sourceUtil.switchWifiUSB(sourceUtil.convertWifiMicUsbSourceWithChannel(SDKUSBSource.values()[this.orgWifiUsbSource]));
        }
        Log.d(TAG, "restoreSwitchStatus: orgWifiUsbSource = " + SDKUSBSource.values()[this.orgWifiUsbSource]);
        Log.d(TAG, "restoreSwitchStatus:isTxbEnable=" + TxbUtil.isTxbEnable());
        if (TxbUtil.isTxbEnable() != this.orgTxbEnable.booleanValue()) {
            TxbUtil.setTxbEnable(this.orgTxbEnable);
        }
        if (this.orgAutoLight != SDKPictureHelper.I.isAutoLightEnabled()) {
            Log.d(TAG, "restoreSwitchStatus: setAutoLightEnable" + this.orgAutoLight);
            SDKPictureHelper.I.setAutoLightEnable(this.orgAutoLight);
        }
        Log.d(TAG, "restoreSwitchStatus: oriEthernetEnable = " + this.oriEthernetEnable + ", oriEthernetMode = " + this.oriEthernetMode);
        WiredNetworkUtil.setEthernetEnable(this, this.oriEthernetEnable);
        WiredNetworkUtil.setEthernetMode(this, this.oriEthernetMode);
    }

    private void showUi() {
        setContentView(R.layout.activit_main_test);
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.main_linear);
        this.mRoot = linearLayout;
        linearLayout.setPadding(dip(5), dip(5), dip(5), dip(5));
        this.mRowContainer = new LinearLayout[this.mRows];
        int i = 0;
        int i2 = 0;
        while (true) {
            LinearLayout[] linearLayoutArr = this.mRowContainer;
            if (i2 >= linearLayoutArr.length) {
                break;
            }
            linearLayoutArr[i2] = new LinearLayout(this);
            this.mRowContainer[i2].setOrientation(1);
            this.mRowContainer[i2].setLayoutParams(new LinearLayout.LayoutParams(dip(this.mCellWidth), -2));
            i2++;
        }
        int i3 = 0;
        while (true) {
            TestItem[] testItemArr = this.mTestItems;
            if (i3 >= testItemArr.length) {
                break;
            }
            if (!testItemArr[i3].mNeedHide) {
                LinearLayout[] linearLayoutArr2 = this.mRowContainer;
                linearLayoutArr2[i3 % linearLayoutArr2.length].addView(this.mTestItems[i3]);
            }
            i3++;
        }
        while (true) {
            LinearLayout[] linearLayoutArr3 = this.mRowContainer;
            if (i >= linearLayoutArr3.length) {
                return;
            }
            this.mRoot.addView(linearLayoutArr3[i]);
            i++;
        }
    }

    private Boolean closeInk() {
        HashMap map = new HashMap();
        map.put(SeewoIntent.KEY_SET_WOL_SLOT, "false");
        return Boolean.valueOf(((EmptyBody) OkHttpHelper.getInstance().postSync(UdiUtil.CloseInk_URL, map, EmptyBody.class)) != null);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void requestFirstTestItemFocus() {
        this.mTestItems[0].setFocusableInTouchMode(true);
        this.mTestItems[0].requestFocus();
    }

    private void showLoadLastResult() {
        if (ConfigParameter.mShowLoadLastTestResult.intValue() == 1) {
            final String strLoadTestResult = TestResultParser.loadTestResult(mTestMode, getFilesDir() + "/");
            if (!strLoadTestResult.isEmpty()) {
                new AskDialog(this, getResources().getString(R.string.app_name), getResources().getString(R.string.ask_load_result), new OnAskDialogResultListener() { // from class: com.ifpdos.factorytest.MainTestActivity.4
                    @Override // com.ifpdos.factorytest.OnAskDialogResultListener
                    public void onAskDialogResult(Context context, boolean z) {
                        if (z) {
                            TestResultParser.parseTestResults(MainTestActivity.this.mTestItems, strLoadTestResult);
                        }
                        MainTestActivity.this.requestFirstTestItemFocus();
                    }
                });
            } else {
                requestFirstTestItemFocus();
            }
        }
        if (ConfigParameter.mAutoTestWhenStart.intValue() == 1) {
            startAutoTest();
        }
        TestResultParser.parseTestResults(this.mTestItems, getIntent().getStringExtra("com.cvte.factoryautotest.EXTRA_RESULTS"));
    }

    @Override // android.app.Activity
    protected void onActivityResult(int i, int i2, Intent intent) {
        Log.i(TAG, "onActivityResult requestCode = " + i + ", resultCode=" + i2 + ", intent=" + intent);
        if (i == AUTOMATIC_TEST_REQUEST) {
            try {
                String stringExtra = intent.getStringExtra("com.cvte.factoryautotest.EXTRA_RESULTS");
                Log.i(TAG, "autoTestResult=" + stringExtra);
                TestResultParser.parseTestResults(this.mTestItems, stringExtra);
                return;
            } catch (Exception e) {
                Log.e(TAG, "" + e);
                return;
            }
        }
        int i3 = 0;
        while (true) {
            TestItem[] testItemArr = this.mTestItems;
            if (i3 >= testItemArr.length) {
                return;
            }
            if (i == testItemArr[i3].mId.ordinal()) {
                this.mTestItems[i3].onActivityResult(i, i2, intent);
            }
            i3++;
        }
    }

    public TestItem findTestItemById(ConfigParser.IDS ids) {
        int i = 0;
        while (true) {
            TestItem[] testItemArr = this.mTestItems;
            if (i >= testItemArr.length) {
                return null;
            }
            if (testItemArr[i].mId == ids) {
                return this.mTestItems[i];
            }
            i++;
        }
    }

    @Override // android.app.Activity, android.view.KeyEvent.Callback
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        TestItem testItemFindTestItemById;
        Log.e(TAG, "onKeyDown: event.code = " + keyEvent.getKeyCode());
        try {
            keyEvent.getDevice().getName();
        } catch (Exception unused) {
        }
        if (keyEvent.getAction() == 1) {
            return true;
        }
        if (i == 4) {
            new AskDialog(this, getResources().getString(R.string.app_name), getResources().getString(R.string.ask_exit_test), new OnAskDialogResultListener() { // from class: com.ifpdos.factorytest.MainTestActivity.5
                @Override // com.ifpdos.factorytest.OnAskDialogResultListener
                public void onAskDialogResult(Context context, boolean z) {
                    if (z) {
                        MainTestActivity.this.finish();
                    }
                }
            });
            return true;
        }
        if (keyEvent.getAction() == 0) {
            if (i == 4) {
                TestItem testItemFindTestItemById2 = findTestItemById(ConfigParser.IDS.BACK_KEY);
                if (testItemFindTestItemById2 != null) {
                    testItemFindTestItemById2.testDone(true, testItemFindTestItemById2.mTagDone);
                    testItemFindTestItemById2.mTested = true;
                }
                return true;
            }
            if (i == 24) {
                TestItem testItemFindTestItemById3 = findTestItemById(ConfigParser.IDS.VOL_UP_KEY);
                if (testItemFindTestItemById3 != null) {
                    testItemFindTestItemById3.testDone(true, testItemFindTestItemById3.mTagDone);
                    testItemFindTestItemById3.mTested = true;
                }
            } else if (i == 25 && (testItemFindTestItemById = findTestItemById(ConfigParser.IDS.VOL_DOWN_KEY)) != null) {
                testItemFindTestItemById.testDone(true, testItemFindTestItemById.mTagDone);
                testItemFindTestItemById.mTested = true;
            }
        }
        return super.onKeyDown(i, keyEvent);
    }

    @Override // android.app.Activity
    public void onStart() {
        super.onStart();
        LanguageHelper.INSTANCE.setLanguage(this);
        Log.e(TAG, "onStart: ");
        int i = 0;
        while (true) {
            TestItem[] testItemArr = this.mTestItems;
            if (i >= testItemArr.length) {
                return;
            }
            testItemArr[i].onStart();
            i++;
        }
    }

    @Override // android.app.Activity
    public void onStop() {
        Log.d(TAG, "onStop: ");
        super.onStop();
        int i = 0;
        while (true) {
            TestItem[] testItemArr = this.mTestItems;
            if (i >= testItemArr.length) {
                return;
            }
            testItemArr[i].onStop();
            i++;
        }
    }

    @Override // android.app.Activity
    public void onDestroy() {
        super.onDestroy();
        handlerStopFactory();
        McuSDK.getInstance().disconnect(this);
        if (this.mKillApp) {
            System.exit(0);
        }
    }

    private void handlerStopFactory() {
        unregisterReceiver(this.usbReceiver);
        this.usbReceiver.onDestroy();
        TestResultParser.saveTestResult(mTestMode, this.mTestItems, getFilesDir() + "/");
        int i = 0;
        while (true) {
            TestItem[] testItemArr = this.mTestItems;
            if (i >= testItemArr.length) {
                break;
            }
            testItemArr[i].onDestroy();
            this.mTestItems[i].mContext = null;
            this.mTestItems[i] = null;
            i++;
        }
        Disposable disposable = this.dis;
        if (disposable != null && !disposable.isDisposed()) {
            this.dis.dispose();
        }
        restoreSwitchStatus();
        stopService(new Intent(this, (Class<?>) FloatNavbarService.class));
        Log.e(TAG, "onDestroy");
    }

    @Override // android.app.Activity, android.view.ContextThemeWrapper, android.content.ContextWrapper
    protected void attachBaseContext(Context context) {
        super.attachBaseContext(context);
        LanguageHelper.INSTANCE.setLanguage(this);
    }

    @Override // android.app.Activity, android.content.ComponentCallbacks
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        LanguageHelper.INSTANCE.setLanguage(this);
    }

    public void startAutoTest() {
        int i = 0;
        while (true) {
            TestItem[] testItemArr = this.mTestItems;
            if (i >= testItemArr.length) {
                return;
            }
            if (!testItemArr[i].mTested) {
                this.mTestItems[i].mAutoTest = true;
            }
            i++;
        }
    }

    @Override // android.app.Activity
    protected void onResume() {
        super.onResume();
        Log.d(TAG, "onResume: ");
        LanguageHelper.INSTANCE.setLanguage(this);
        if (this.initReady) {
            startService(new Intent(this, (Class<?>) FloatNavbarService.class));
        }
        int i = 0;
        while (true) {
            TestItem[] testItemArr = this.mTestItems;
            if (i >= testItemArr.length) {
                return;
            }
            testItemArr[i].onResume();
            i++;
        }
    }

    @Override // android.app.Activity
    protected void onPause() {
        super.onPause();
        Log.d(TAG, "onPause: ");
        int i = 0;
        while (true) {
            TestItem[] testItemArr = this.mTestItems;
            if (i < testItemArr.length) {
                testItemArr[i].onPause();
                i++;
            } else {
                stopService(new Intent(this, (Class<?>) FloatNavbarService.class));
                return;
            }
        }
    }

    @Override // android.app.Activity
    protected void onNewIntent(Intent intent) {
        int i = 0;
        while (true) {
            TestItem[] testItemArr = this.mTestItems;
            if (i >= testItemArr.length) {
                return;
            }
            testItemArr[i].onNewIntent(intent);
            i++;
        }
    }

    @Override // com.ifpdos.factorytest.ActivityRecreator
    public void recreateActivity() {
        this.mKillApp = false;
        recreate();
    }
}
