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();
}
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;
}
}
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());
}
Aggregations