// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.oliodevices.assist.app; import android.app.Service; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.Uri; import android.os.Handler; import android.os.IBinder; import com.olio.communication.bluetooth.BluetoothStatusHandler; import com.olio.communication.messages.Message; import com.olio.olios.controller.OlioController; import com.olio.olios.controller.OlioControllerManager; import com.olio.olios.detector.DetectorManager; import com.olio.olios.detector.ManagedDetector; import com.olio.util.ALog; import com.oliodevices.assist.app.api.UserManager; import com.oliodevices.assist.app.controller.TransferManager; import com.oliodevices.assist.app.controller.sync.PersonalAssistantContextSyncMonitor; import com.oliodevices.assist.app.controller.sync.SerializedRecordSyncMonitor; import com.oliodevices.assist.app.detectors.BroadcastDelegate; import com.oliodevices.assist.app.detectors.LocationDetector; import com.oliodevices.assist.app.detectors.LookDetector; import com.oliodevices.assist.app.detectors.NotificationDetector; import com.oliodevices.assist.app.detectors.OlioCalendarComplicationUpdater; import com.oliodevices.assist.app.detectors.PersonalAssistantContextDetector; import com.oliodevices.assist.app.detectors.PhoneSyncConnectionMonitor; import com.oliodevices.assist.app.detectors.PhysicalActivityDetector; import com.oliodevices.assist.app.detectors.SettingsJsonDetector; import com.oliodevices.assist.app.detectors.SoftwareDetector; import com.oliodevices.assist.app.detectors.TimeDetector; import com.oliodevices.assist.app.detectors.WeatherDetector; import com.oliodevices.assist.app.detectors.firmware.FirmwareDetector; import com.oliodevices.assist.bluetooth.BluetoothMessageManager; import java.util.Arrays; public class NotificationAggregatorService extends Service { public class NotificationReceiver extends BroadcastReceiver { final NotificationAggregatorService this$0; public void onReceive(Context context, Intent intent) { if (intent.hasExtra("notification")) { context = (Message)intent.getParcelableExtra("notification"); sendMessage(context); } else if (intent.hasExtra("file_uri")) { context = (Uri)intent.getParcelableExtra("file_uri"); if (bluetoothMessageManager != null) { bluetoothMessageManager.sendFile(context); return; } } else { ALog.e("Unexpected intent received: %s", new Object[] { intent.toString() }); return; } } public NotificationReceiver() { this$0 = NotificationAggregatorService.this; super(); } } public static String BLUETOOTH_DEVICE = "BLUETOOTH_DEVICE"; public static final String CONNECTION_STATE = "CONNECTION_STATE"; public static final String DEVICE_ADDRESS = "DEVICE_ADDRESS"; public static final String DEVICE_NAME = "DEVICE_NAME"; public static final String NOTIFICATION_ACTION_EXTRA = "notification_action"; public static final String NOTIFICATION_CONNECTION_STATE = "com.oliodevices.bluetooth_host.bluetooth.connection_state"; public static final String NOTIFICATION_EXTRA_KEY = "notification"; public static final String NOTIFICATION_FILE_URI = "file_uri"; public static final String NOTIFICATION_RECEIVER_INTENT_FILTER = "com.oliodevices.bluetooth_host.notification_receiver"; private static String TAG = "BroadcastDelegate"; private BluetoothMessageManager bluetoothMessageManager; private BluetoothStatusHandler bluetoothStatusHandler; private OlioControllerManager controllerManager; private DetectorManager detectorManager; BluetoothDevice mDevice; private NotificationReceiver mNotificationReceiver; private PersonalAssistantContextSyncMonitor personalAssistantContextSyncMonitor; private SerializedRecordSyncMonitor serializedRecordSyncMonitor; public NotificationAggregatorService() { } private BluetoothDevice getPairedDevice() { String s = UserManager.getInstance().getUnitId(); if (s == null || "".equals(s)) { return null; } else { return BluetoothAdapter.getDefaultAdapter().getRemoteDevice(s); } } public IBinder onBind(Intent intent) { ALog.d("onBind", new Object[0]); return null; } public void onCreate() { ALog.d("onCreate", new Object[0]); super.onCreate(); Object obj = new IntentFilter("com.oliodevices.bluetooth_host.notification_receiver"); mNotificationReceiver = new NotificationReceiver(); registerReceiver(mNotificationReceiver, ((IntentFilter) (obj))); obj = Arrays.asList(new ManagedDetector[] { new LocationDetector(getBaseContext()), new LookDetector(getBaseContext()), new TimeDetector(getBaseContext()), new WeatherDetector(getBaseContext(), new BroadcastDelegate(getBaseContext())), new OlioCalendarComplicationUpdater(getBaseContext()), new SettingsJsonDetector(getApplicationContext(), new BroadcastDelegate(getBaseContext())), new SoftwareDetector(getApplicationContext(), new BroadcastDelegate(getBaseContext())), new FirmwareDetector(getApplicationContext(), new BroadcastDelegate(getBaseContext())), new PersonalAssistantContextDetector(getApplicationContext(), new BroadcastDelegate(getBaseContext())), new PhysicalActivityDetector(getBaseContext()), new NotificationDetector(getApplicationContext()), new PhoneSyncConnectionMonitor(getApplicationContext()) }); controllerManager = new OlioControllerManager(Arrays.asList(new OlioController[] { new TransferManager(getBaseContext()) })); controllerManager.create(); controllerManager.register(); detectorManager = new DetectorManager(((java.util.List) (obj)), this, com.olio.data.object.bluetooth_status.BluetoothNotificationObserver.Platform.PHONE); detectorManager.register(); serializedRecordSyncMonitor = new SerializedRecordSyncMonitor(getApplicationContext(), getContentResolver()); serializedRecordSyncMonitor.register(new Handler(getMainLooper()), getContentResolver()); personalAssistantContextSyncMonitor = new PersonalAssistantContextSyncMonitor(getApplicationContext(), getContentResolver()); personalAssistantContextSyncMonitor.register(new Handler(getMainLooper()), getContentResolver()); } public void onDestroy() { ALog.d("onDestroy", new Object[0]); super.onDestroy(); if (bluetoothMessageManager != null) { bluetoothMessageManager.destroy(); } detectorManager.unregister(); serializedRecordSyncMonitor.unregister(); personalAssistantContextSyncMonitor.unregister(); controllerManager.unregister(); controllerManager.destroy(); bluetoothMessageManager = null; if (mNotificationReceiver != null) { getBaseContext().unregisterReceiver(mNotificationReceiver); mNotificationReceiver = null; } } public int onStartCommand(Intent intent, int i, int j) { ALog.d("onStartCommand", new Object[0]); intent = getPairedDevice(); if (intent == null) { break MISSING_BLOCK_LABEL_89; } this; JVM INSTR monitorenter ; if (bluetoothMessageManager != null) goto _L2; else goto _L1 _L1: ALog.d("bluetoothMessageManager is null, creating a messagemanager", new Object[0]); bluetoothMessageManager = new BluetoothMessageManager(intent, getBaseContext()); bluetoothMessageManager.initialize(); _L4: this; JVM INSTR monitorexit ; break MISSING_BLOCK_LABEL_89; _L2: if (intent == null) goto _L4; else goto _L3 _L3: bluetoothMessageManager.resetBluetooth(intent.getAddress()); goto _L4 intent; this; JVM INSTR monitorexit ; throw intent; return 1; } public void sendMessage(Message message) { if (bluetoothMessageManager != null) { bluetoothMessageManager.sendMessage(message); } } }