// 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.bluetooth; import android.content.Context; import android.content.Intent; import android.media.AudioManager; import android.os.Handler; import android.os.SystemClock; import android.view.KeyEvent; import com.olio.util.ALog; import com.oliodevices.assist.app.detectors.status_bar_detectors.NotificationHandlerService; import java.lang.reflect.Method; import java.nio.ByteBuffer; public class BluetoothParser { private static final String TAG = "BluetoothParser"; public BluetoothParser() { } private static void adjustVolume(int i, Context context) { ((AudioManager)context.getSystemService("audio")).adjustStreamVolume(3, i, 0); } private static void audioOutput(boolean flag) { Object obj; try { obj = Class.forName("android.media.AudioSystem").getMethod("setForceUse", new Class[] { Integer.TYPE, Integer.TYPE }); } // Misplaced declaration of an exception variable catch (Object obj) { ALog.i("could not load audioSystemClass", new Object[0]); return; } if (obj != null) goto _L2; else goto _L1 _L1: ALog.i("could not load setForceUse method", new Object[0]); _L4: if (!flag) { break; /* Loop/switch isn't completed */ } if (obj != null) { break MISSING_BLOCK_LABEL_57; } ALog.i("setForceUse is null", new Object[0]); ((Method) (obj)).invoke(null, new Object[] { Integer.valueOf(1), Integer.valueOf(4) }); ALog.i("set to bluetooth speakers", new Object[0]); return; _L2: ALog.i("setForceUse loaded correctly", new Object[0]); if (true) goto _L4; else goto _L3 _L3: if (obj != null) { break MISSING_BLOCK_LABEL_127; } ALog.i("setForceUse is null", new Object[0]); ((Method) (obj)).invoke(null, new Object[] { Integer.valueOf(1), Integer.valueOf(1) }); ALog.i("set to internal speakers", new Object[0]); return; Exception exception; exception; ALog.i((new StringBuilder()).append("setForceUse exception:").append(exception.getMessage()).toString(), new Object[0]); return; } public static boolean parse(byte abyte0[], Context context) { int i = ByteBuffer.wrap(abyte0).getInt(); abyte0 = ByteBuffer.wrap(abyte0); switch (i) { case 3: // '\003' default: return true; case 4: // '\004' send(87, context); return true; case 5: // '\005' send(88, context); return true; case 1: // '\001' send(85, context); return true; case 2: // '\002' send(85, context); return true; case 6: // '\006' adjustVolume(1, context); return true; case 7: // '\007' adjustVolume(-1, context); // fall through case 8: // '\b' audioOutput(true); // fall through case 9: // '\t' audioOutput(false); return true; case 10: // '\n' removeNotification(abyte0, context); break; } return true; } private static void removeNotification(ByteBuffer bytebuffer, Context context) { byte abyte0[] = new byte[bytebuffer.getInt()]; bytebuffer.get(abyte0); String s = new String(abyte0); int i = bytebuffer.getInt(); Object obj = null; if (i > 0) { obj = new byte[i]; bytebuffer.get(((byte []) (obj))); obj = new String(((byte []) (obj))); } i = bytebuffer.getInt(); bytebuffer = new Intent(NotificationHandlerService.NOTIFICATION_DETECTOR_INTENT_FILTER); bytebuffer.putExtra("command", NotificationHandlerService.REMOVE_NOTIFICATION); bytebuffer.putExtra(NotificationHandlerService.PKG, s); bytebuffer.putExtra(NotificationHandlerService.NOT_TAG, ((String) (obj))); bytebuffer.putExtra(NotificationHandlerService.NOT_ID, i); context.sendBroadcast(bytebuffer); } private static void send(int i, Context context) { SystemClock.uptimeMillis(); Intent intent = new Intent("android.intent.action.MEDIA_BUTTON", null); intent.putExtra("android.intent.extra.KEY_EVENT", new KeyEvent(0, i)); context.sendOrderedBroadcast(intent, null); (new Handler()).postDelayed(new Runnable(i, context) { final Context val$context; final int val$keyCode; public void run() { Intent intent1 = new Intent("android.intent.action.MEDIA_BUTTON", null); intent1.putExtra("android.intent.extra.KEY_EVENT", new KeyEvent(1, keyCode)); context.sendOrderedBroadcast(intent1, null); } { keyCode = i; context = context1; super(); } }, 100L); } }