Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.android.internal.telephony.gsm;
- import android.content.BroadcastReceiver;
- import android.content.Context;
- import android.content.Intent;
- import android.content.IntentFilter;
- import android.content.SharedPreferences;
- import android.database.Cursor;
- import android.database.sqlite.SQLiteDatabase;
- import android.database.sqlite.SQLiteException;
- import android.util.Log;
- import com.android.internal.telephony.PhoneBase;
- import java.io.File;
- public class FastDorm
- {
- private static final boolean DBG = false;
- private static final String FD_PREFERENCES_NAME = "fdormancy.preferences_name";
- private static final String KEY_FD_STATE = "fdormancy.key.state";
- protected final String LOG_TAG = "GSM";
- File databaseFile;
- private boolean dormLCDOffPolicy = 0;
- private boolean dormLCDOnPolicy = 0;
- private int mDefaultDormTime = 5000;
- SQLiteDatabase mDormDb;
- private boolean mDormancyFlag;
- private BroadcastReceiver mFastDormancyLCDRcvr;
- private IntentFilter mIntentFilter;
- private boolean mIsScreenOn = 1;
- private int mScreenOffDormTime = -1;
- private int mScreenOnDormTime = -1;
- protected PhoneBase phone;
- public FastDorm()
- {
- }
- public FastDorm(PhoneBase paramPhoneBase)
- {
- this.phone = paramPhoneBase;
- int i = Log.e("GSM", "[FD] FastDormancy Constructor No plmn");
- IntentFilter localIntentFilter1 = new IntentFilter();
- this.mIntentFilter = localIntentFilter1;
- this.mIntentFilter.addAction("android.intent.action.SCREEN_ON");
- this.mIntentFilter.addAction("android.intent.action.SCREEN_OFF");
- FastDorm.1 local1 = new FastDorm.1(this);
- this.mFastDormancyLCDRcvr = local1;
- Context localContext = paramPhoneBase.getContext();
- BroadcastReceiver localBroadcastReceiver = this.mFastDormancyLCDRcvr;
- IntentFilter localIntentFilter2 = this.mIntentFilter;
- Intent localIntent = localContext.registerReceiver(localBroadcastReceiver, localIntentFilter2);
- }
- public FastDorm(PhoneBase paramPhoneBase, String paramString)
- {
- this.phone = paramPhoneBase;
- String str = "[FD] FastDormancy Constructor plmn: " + paramString;
- int i = Log.e("GSM", str);
- }
- private void readNwkinfoDb()
- {
- File localFile1 = new File("/data/data/com.android.providers.telephony/databases", "nwk_info.db");
- this.databaseFile = localFile1;
- if (!this.databaseFile.exists())
- {
- File localFile2 = new File("/system/csc", "nwk_info.db");
- this.databaseFile = localFile2;
- if (!this.databaseFile.exists())
- {
- int i = Log.e("GSM", "[FD] no nwk info db");
- return;
- }
- int j = Log.e("GSM", "[FD] csc system area");
- }
- while (true)
- {
- try
- {
- SQLiteDatabase localSQLiteDatabase = SQLiteDatabase.openDatabase(this.databaseFile.getPath(), null, 1);
- this.mDormDb = localSQLiteDatabase;
- return;
- }
- catch (SQLiteException localSQLiteException)
- {
- int k = Log.e("GSM", "[FD] nwk info db open exception");
- return;
- }
- int m = Log.e("GSM", "[FD] provider data area");
- }
- }
- private void setDormancyTime(String paramString)
- {
- String str1 = "(plmn = '" + paramString + "')";
- String str2 = "[FD] setDormancyTime: " + paramString;
- int i = Log.e("GSM", str2);
- while (true)
- {
- try
- {
- if (this.mDormDb == null)
- break label457;
- Cursor localCursor = this.mDormDb.query("dormpolicy", null, str1, null, null, null, null);
- if (localCursor == null)
- break;
- int j = Log.e("GSM", "[FD] (cursor != null) ");
- if (!localCursor.moveToFirst())
- break label363;
- int k = Log.e("GSM", "[FD] (cursor.moveToFirst()) ");
- int m = localCursor.getColumnIndexOrThrow("lcdonfdtime");
- int n = localCursor.getInt(m) * 1000;
- this.mScreenOnDormTime = n;
- if (this.mScreenOnDormTime <= 0)
- continue;
- this.dormLCDOnPolicy = 1;
- int i1 = localCursor.getColumnIndexOrThrow("lcdofffdtime");
- int i2 = localCursor.getInt(i1) * 1000;
- this.mScreenOffDormTime = i2;
- if (this.mScreenOffDormTime > 0)
- {
- this.dormLCDOffPolicy = 1;
- StringBuilder localStringBuilder1 = new StringBuilder().append("[FD] mScreenOnDormTime: ");
- int i3 = this.mScreenOnDormTime;
- StringBuilder localStringBuilder2 = localStringBuilder1.append(i3).append(" dormLCDOnPolicy: ");
- boolean bool1 = this.dormLCDOnPolicy;
- StringBuilder localStringBuilder3 = localStringBuilder2.append(bool1).append(" \t ").append(" mScreenOffDormTime: ");
- int i4 = this.mScreenOffDormTime;
- StringBuilder localStringBuilder4 = localStringBuilder3.append(i4).append(" dormLCDOffPolicy: ");
- boolean bool2 = this.dormLCDOffPolicy;
- String str3 = bool2 + " in DB";
- int i5 = Log.e("GSM", str3);
- localCursor.close();
- return;
- this.mScreenOnDormTime = 0;
- this.dormLCDOnPolicy = 0;
- continue;
- }
- }
- catch (SQLiteException localSQLiteException)
- {
- int i6 = Log.e("GSM", "[FD] Exception during getDormancyTime");
- return;
- }
- int i7 = 0;
- this.mScreenOffDormTime = i7;
- this.dormLCDOffPolicy = 0;
- continue;
- label363: int i8 = this.mDefaultDormTime;
- this.mScreenOnDormTime = i8;
- int i9 = this.mDefaultDormTime;
- this.mScreenOffDormTime = i9;
- this.dormLCDOnPolicy = 1;
- this.dormLCDOffPolicy = 1;
- int i10 = Log.e("GSM", "[FD] By default FD, !(cursor.moveToFirst()) ");
- }
- int i11 = this.mDefaultDormTime;
- this.mScreenOnDormTime = i11;
- int i12 = this.mDefaultDormTime;
- this.mScreenOffDormTime = i12;
- this.dormLCDOnPolicy = 1;
- this.dormLCDOffPolicy = 1;
- int i13 = Log.e("GSM", "[FD] By default FD, No Cursor ");
- return;
- label457: int i14 = Log.e("GSM", "[FD] There's no mDormDb in setDormancyTime");
- }
- public void close()
- {
- Context localContext = this.phone.getContext();
- BroadcastReceiver localBroadcastReceiver = this.mFastDormancyLCDRcvr;
- localContext.unregisterReceiver(localBroadcastReceiver);
- int i = Log.e("GSM", "[FD] FastDormancy Constructor closed");
- }
- public int getDefaultDormTime()
- {
- return this.mDefaultDormTime;
- }
- public boolean getDormancyFlag(String paramString)
- {
- int i = 1;
- if (paramString == null)
- int k = Log.e("GSM", "[FD] No op numeric");
- for (int m = 1; ; m = 0)
- {
- return m;
- if (!paramString.equals("45001"))
- break;
- int n = Log.e("GSM", "[FD] Now Samsung Test Bed");
- }
- SharedPreferences localSharedPreferences = this.phone.getContext().getSharedPreferences("fdormancy.preferences_name", 3);
- int j;
- if ((localSharedPreferences != null) && (localSharedPreferences.contains("fdormancy.key.state")))
- {
- if (localSharedPreferences.getBoolean("fdormancy.key.state", 1));
- for (i = 1; ; j = 0)
- {
- String str = "[FD] Dormant flag(" + i + ") from key string";
- int i1 = Log.e("GSM", str);
- m = i;
- break;
- }
- }
- if (this.mIsScreenOn)
- if (this.dormLCDOnPolicy)
- j = 1;
- while (true)
- {
- m = j;
- break;
- j = 0;
- continue;
- if (this.dormLCDOffPolicy)
- {
- j = 1;
- continue;
- }
- j = 0;
- }
- }
- public int getScreenOffDormTime()
- {
- return this.mScreenOffDormTime;
- }
- public int getScreenOnDormTime()
- {
- return this.mScreenOnDormTime;
- }
- public void init(String paramString)
- {
- readNwkinfoDb();
- setDormancyTime(paramString);
- if (this.mDormDb == null)
- return;
- this.mDormDb.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment