Search in sources :

Example 1 with DexWrap

use of lanchon.dexpatcher.annotation.DexWrap in project AmazMod by edotassi.

the class CompanionApplication method onCreate.

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
@SuppressLint({ "MissingSuperCall", "ResourceType" })
@DexWrap
public void onCreate() {
    Boolean enableRtl = PreferenceManager.getBoolean(this, Constants.PREFERENCE_ENABLE_RTL, false);
    Configuration configuration = getResources().getConfiguration();
    configuration.setLayoutDirection(new Locale(enableRtl ? "fa" : "en"));
    getResources().updateConfiguration(configuration, getResources().getDisplayMetrics());
    Boolean disableCrashReporting = PreferenceManager.getBoolean(this, Constants.PREFERENCE_DISABLE_CRASH_REPORTING, false);
    CrashlyticsCore crashlyticsCore = new CrashlyticsCore.Builder().disabled(!disableCrashReporting.booleanValue()).build();
    Fabric.with(this, new Crashlytics.Builder().core(crashlyticsCore).build());
    a = this;
    if (!Config.isOversea() && !b()) {
        return;
    }
    Box.initDefault(this);
    a();
    Log.Settings settings = Log.init();
    settings.setLogLevel(Config.isDebug() ? Log.LogLevel.FULL : Log.LogLevel.FILE_ONLY).setLogFile(StorageUtil.getLogFile(this));
    Log.d("CompanionApp", "OnAppCreate : " + AppUtil.getVersionNameAndCode(this), new Object[0]);
    super.onCreate();
    /*
        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, Throwable throwable) {
                Log.e("CompanionApp", "Crash(" + thread + ")", throwable, new Object[0]);
                System.exit(1);
            }
        });
        */
    Analytics.config(true, Config.isDebug(), true, this, AppUtil.getMetaDataChannel(this));
    AccountManager.getDefault(this).setTestMode(Config.isTestHosts());
    // AccountManager.getDefault(this).setGlobalMode(true);
    ActiveAndroid.initialize(this, Config.isDebug());
    NotificationManager.getManager(this).init();
    if (DeviceCompatibility.MIUI.isMIUI(this)) {
        MiuiAPI.getInstance(this).init();
    }
    SyncThrottler.init(this);
    BindUtil.unbindUnfinishedDevice(this);
    j = Transporter.get(this, "com.huami.watch.companion");
    j.addChannelListener(k);
    j.addDataListener(l);
    j.connectTransportService();
    Transporter object = Transporter.get(this, "com.huami.watch.companion.syncdata");
    object.addDataListener(m);
    object.connectTransportService();
    object = Transporter.get(this, "com.huami.action.notification");
    object.addDataListener(n);
    object.connectTransportService();
    o = Transporter.get(this, "com.huami.watch.health");
    o.addDataListener(p);
    o.connectTransportService();
    if (f == null) {
        f = new AskAndAnswer(this);
    }
    if (g == null) {
        g = new CallingWearHelper(this);
    }
    if (h == null) {
        h = new DataCollection(this);
    }
    startService(new Intent(this, BGService_msg.class));
    startService(new Intent(this, OtaService.class));
    startService(new Intent(this, IMEservice.class));
    SyncWatchFaceBgHelper.getHelper().startFileTransporter(this);
    AGpsSyncHelper.getHelper().startFileTransporter(this);
    if (DeviceManager.getManager(this).hasBoundDevice()) {
        AGpsSyncService.scheduleSync(this, "AppOnCreate");
        startService(new Intent(this, WeatherService.class));
    }
    a(this);
    SyncWatchHealthHelper.getHelper().init(this);
    SyncWatchSportHelper.getHelper().init(this);
    WearHttpSupportInterface.doInit(this);
    /* Ok */
    ConnectionReceiver connectionReceiver = new ConnectionReceiver();
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
    intentFilter.addAction("com.huami.watch.WATCH_CONNED_4_COMPANION");
    intentFilter.addAction("com.huami.watch.companion.action.UnbindDeviceStart");
    intentFilter.addAction("com.huami.watch.httpsupport.COLLECT_DATA");
    intentFilter.addAction("com.huami.watch.companion.action.HOST_START_SYNC_DATA");
    registerReceiver(connectionReceiver, intentFilter);
    TimeChangedReceiver timeChangedReceiver = new CompanionApplication.TimeChangedReceiver();
    IntentFilter timeSet = new IntentFilter("android.intent.action.TIME_SET");
    timeSet.addAction("android.intent.action.TIMEZONE_CHANGED");
    registerReceiver(timeChangedReceiver, timeSet);
    IntentFilter wifiStateChangeConnectivityChange = new IntentFilter();
    wifiStateChangeConnectivityChange.addAction("android.net.wifi.STATE_CHANGE");
    wifiStateChangeConnectivityChange.addAction("android.net.conn.CONNECTIVITY_CHANGE");
    registerReceiver(q, wifiStateChangeConnectivityChange);
    new RxConsumerStarter().init(this);
    BindUtil.connectCurrentDevice(this);
    Device device = DeviceManager.getManager(this).getCurrentDevice();
    if (device != null && DeviceUtil.hasEmptyInfo(device)) {
        SyncDeviceInfoHelper.getHelper(this).startAsync();
    }
    PlayFlavor.initApp(this);
    e = new HttpProxyServer(getApplicationContext());
    e.init();
    if (getResources().getBoolean(2131427330)) {
        CommandHandler.getInstance(this);
    }
    WatchWifiFtpUtil.init(getApplicationContext());
    registerActivityLifecycleCallbacks(new AppEnterForegroundCallBack());
    BleLostWarningManager.init(getApplicationContext());
    if (DeviceCompatibility.isHuaWeiPhone() && !DeviceCompatibility.isO()) {
    // DummyJobService.startSchedule(this);
    }
    FileDownloader.init(getApplicationContext(), new DownloadMgrInitialParams.InitCustomMaker().connectionCreator(new FileDownloadUrlConnection.Creator(new FileDownloadUrlConnection.Configuration().connectTimeout(15000).readTimeout(15000).proxy(Proxy.NO_PROXY))));
    Boot.sharedInstance(this).run();
}
Also used : Locale(java.util.Locale) CrashlyticsCore(com.crashlytics.android.core.CrashlyticsCore) Configuration(android.content.res.Configuration) CallingWearHelper(com.huami.watch.companion.wearcalling.CallingWearHelper) IMEservice(com.huami.watch.companion.IME.IMEservice) AskAndAnswer(com.huami.watch.companion.findphone.AskAndAnswer) WeatherService(com.huami.watch.companion.weather.WeatherService) AppEnterForegroundCallBack(com.huami.watch.companion.util.AppEnterForegroundCallBack) IntentFilter(android.content.IntentFilter) HttpProxyServer(com.huami.watch.companion.components.bluetoothproxyserver.HttpProxyServer) OtaService(com.huami.watch.companion.otaphone.service.OtaService) Log(com.huami.watch.util.Log) ConnectionReceiver(com.huami.watch.transport.httpsupport.global.ConnectionReceiver) Device(com.huami.watch.companion.device.Device) Intent(android.content.Intent) Crashlytics(com.crashlytics.android.Crashlytics) DataCollection(com.huami.watch.companion.datacollection.DataCollection) BGService_msg(com.huami.watch.hmwatchmanager.bt_connect.BGService_msg) Transporter(com.huami.watch.transport.Transporter) DexWrap(lanchon.dexpatcher.annotation.DexWrap) RequiresApi(android.support.annotation.RequiresApi) SuppressLint(android.annotation.SuppressLint)

Example 2 with DexWrap

use of lanchon.dexpatcher.annotation.DexWrap in project AmazMod by edotassi.

the class NotificationAccessService method onNotificationRemoved.

@DexWrap
@Override
public void onNotificationRemoved(StatusBarNotification statusBarNotification) {
    if (PreferenceManager.getBoolean(this, Constants.PREFERENCE_DISABLE_NOTIFICATIONS_MOD, false)) {
        onNotificationRemoved(statusBarNotification);
    } else {
        if (notificationsSent == null) {
            notificationsSent = new ArrayList<>();
        }
        String packageName = statusBarNotification.getPackageName();
        List<StatusBarNotification> notificationsRemain = new ArrayList<>();
        for (StatusBarNotification statusBarNotificationSent : notificationsSent) {
            if (statusBarNotificationSent.getPackageName().equals(packageName)) {
                Log.d(Constants.TAG_NOTIFICATION_SERVICE, "removed: " + statusBarNotificationSent.getKey());
                onNotificationRemoved(statusBarNotificationSent);
            } else {
                Log.d(Constants.TAG_NOTIFICATION_SERVICE, "not removed: " + statusBarNotificationSent.getKey());
                notificationsRemain.add(statusBarNotificationSent);
            }
        }
        notificationsSent = notificationsRemain;
    }
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification) ArrayList(java.util.ArrayList) DexWrap(lanchon.dexpatcher.annotation.DexWrap)

Example 3 with DexWrap

use of lanchon.dexpatcher.annotation.DexWrap in project AmazMod by edotassi.

the class BatteryCard method updateBatteryViews.

@DexWrap
public void updateBatteryViews(BatteryInfo batteryInfo) {
    updateBatteryViews(batteryInfo);
    BatteryRead batteryRead = new BatteryRead();
    batteryRead.setDate(System.currentTimeMillis());
    batteryRead.setLevel(batteryInfo.getBatteryLevel());
    batteryRead.setCharging(batteryInfo.isBatteryCharging());
    FlowManager.getModelAdapter(BatteryRead.class).insert(batteryRead);
    Log.d("BatteryChart", "level: " + batteryInfo.getBatteryLevel());
    RxBus.get().post(new BatteryHistoryUpdatedEvent());
}
Also used : BatteryRead(com.edotasx.amazfit.db.model.BatteryRead) BatteryHistoryUpdatedEvent(com.edotasx.amazfit.events.BatteryHistoryUpdatedEvent) DexWrap(lanchon.dexpatcher.annotation.DexWrap)

Aggregations

DexWrap (lanchon.dexpatcher.annotation.DexWrap)3 SuppressLint (android.annotation.SuppressLint)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 Configuration (android.content.res.Configuration)1 StatusBarNotification (android.service.notification.StatusBarNotification)1 RequiresApi (android.support.annotation.RequiresApi)1 Crashlytics (com.crashlytics.android.Crashlytics)1 CrashlyticsCore (com.crashlytics.android.core.CrashlyticsCore)1 BatteryRead (com.edotasx.amazfit.db.model.BatteryRead)1 BatteryHistoryUpdatedEvent (com.edotasx.amazfit.events.BatteryHistoryUpdatedEvent)1 IMEservice (com.huami.watch.companion.IME.IMEservice)1 HttpProxyServer (com.huami.watch.companion.components.bluetoothproxyserver.HttpProxyServer)1 DataCollection (com.huami.watch.companion.datacollection.DataCollection)1 Device (com.huami.watch.companion.device.Device)1 AskAndAnswer (com.huami.watch.companion.findphone.AskAndAnswer)1 OtaService (com.huami.watch.companion.otaphone.service.OtaService)1 AppEnterForegroundCallBack (com.huami.watch.companion.util.AppEnterForegroundCallBack)1 CallingWearHelper (com.huami.watch.companion.wearcalling.CallingWearHelper)1 WeatherService (com.huami.watch.companion.weather.WeatherService)1