// 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.olio.util; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.os.AsyncTask; import android.os.Environment; import com.olio.communication.messages.files.TransferStatus; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; // Referenced classes of package com.olio.util: // ALog public class SharedUtils { public SharedUtils() { } public static int batteryPercentage(Intent intent) { return (intent.getIntExtra("level", 0) * 100) / intent.getIntExtra("scale", 100); } public static boolean bootInRetailMode(Context context) { context = new File((new StringBuilder()).append(Environment.getExternalStorageDirectory()).append(File.separator).append(context.getResources().getString(com.olio.comunication.R.string.base_file_directory)).toString(), "retail_mode_on"); return context != null && context.exists(); } public static void dumpLogcat() { (new AsyncTask() { protected volatile Object doInBackground(Object aobj[]) { return doInBackground((Void[])aobj); } protected transient Void doInBackground(Void avoid[]) { avoid = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec((new StringBuilder()).append("logcat -d -v threadtime -f ").append(Environment.getExternalStorageDirectory()).append(File.separator).append("olio").append(File.separator).append(System.currentTimeMillis()).append(".log").toString()).getErrorStream())); _L1: String s = avoid.readLine(); if (s == null) { break MISSING_BLOCK_LABEL_104; } ALog.d(s, new Object[0]); goto _L1 avoid; ALog.e("Exception writing logcat", avoid, new Object[0]); return null; } }).doInBackground(new Void[0]); } public static int getBuildNumberFromVersionString(String s) { int i; try { s = s.split("\\."); i = Integer.parseInt(s[s.length - 1]); } // Misplaced declaration of an exception variable catch (String s) { return 0; } return i; } public static int getPauseReasonFromTransferStatus(TransferStatus transferstatus) { if (transferstatus.getPausedReason() != null) goto _L2; else goto _L1 _L1: return 5; _L2: byte byte0; transferstatus = transferstatus.getPausedReason(); byte0 = -1; transferstatus.hashCode(); JVM INSTR lookupswitch 6: default 80 // -2089416984: 136 // -1820305068: 150 // -1673907715: 178 // -161567338: 192 // 828332044: 122 // 1710881068: 164; goto _L3 _L4 _L5 _L6 _L7 _L8 _L9 _L3: switch (byte0) { default: return 0; case 0: // '\0' return 1; case 1: // '\001' return 2; case 2: // '\002' return 3; case 3: // '\003' return 4; case 5: // '\005' return 6; case 4: // '\004' break; } if (true) goto _L1; else goto _L8 _L8: if (transferstatus.equals("NOTONCHARGER")) { byte0 = 0; } goto _L3 _L4: if (transferstatus.equals("LOWCHARGE")) { byte0 = 1; } goto _L3 _L5: if (transferstatus.equals("TEMPERATURE")) { byte0 = 2; } goto _L3 _L9: if (transferstatus.equals("ABOVE95_SCREEN_ON")) { byte0 = 3; } goto _L3 _L6: if (transferstatus.equals("NOTCHARGED")) { byte0 = 4; } goto _L3 _L7: if (transferstatus.equals("NOTCONNECTED")) { byte0 = 5; } goto _L3 } public static boolean isCharging(Intent intent) { int i = intent.getIntExtra("status", -1); return i == 2 || i == 5; } public static void setRetailMode(boolean flag, Context context) { Object obj = new File((new StringBuilder()).append(Environment.getExternalStorageDirectory()).append(File.separator).append(context.getResources().getString(com.olio.comunication.R.string.base_file_directory)).toString(), "retail_mode_on"); if (flag) { if (obj != null && !((File) (obj)).exists()) { try { ((File) (obj)).createNewFile(); } // Misplaced declaration of an exception variable catch (Object obj) { ALog.e("Could not create retail mode indicator file.", new Object[0]); } } } else if (obj != null && ((File) (obj)).exists()) { ((File) (obj)).delete(); } if (flag) { obj = "ON"; } else { obj = "OFF"; } ALog.d("Sending broadcast for RetailMode %s", new Object[] { obj }); context.sendBroadcast((new Intent("com.oliodevices.assist.intent.action.RETAIL_MODE")).putExtra("retail_mode_state", flag)); } public static int temperature(Intent intent) { return (int)((float)intent.getIntExtra("temperature", 0) / 10F); } }