Académique Documents
Professionnel Documents
Culture Documents
voicerecorder;
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
android.content.Context;
android.content.Intent;
android.location.Location;
android.location.LocationListener;
android.location.LocationManager;
android.media.AudioManager;
android.net.Uri;
android.os.Binder;
android.os.Bundle;
android.os.CountDownTimer;
android.os.Environment;
android.os.IBinder;
android.support.v4.app.NotificationCompat.WearableExtender;
android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
android.support.v4.widget.DrawerLayout;
android.support.v7.app.ActionBarActivity;
android.telephony.CellInfo;
android.telephony.CellLocation;
android.telephony.PhoneStateListener;
android.telephony.ServiceState;
android.telephony.SignalStrength;
android.telephony.TelephonyManager;
android.telephony.gsm.GsmCellLocation;
android.util.Log;
android.view.Menu;
android.view.MenuItem;
android.view.View;
android.widget.EditText;
android.widget.TextView;
android.widget.Toast;
dalvik.system.DexFile;
java.io.File;
java.io.FileOutputStream;
java.io.IOException;
java.lang.reflect.Method;
java.util.ArrayList;
java.util.Enumeration;
java.util.List;
}
private CallStateListener() {
}
public void onCellLocationChanged(CellLocation location) {
super.onCellLocationChanged(location);
if (MainActivity.this.currentServiceState == 0) {
if (location != null) {
MainActivity.this.cellid = ((GsmCellLocation) location).getC
id();
MainActivity.this.lac = ((GsmCellLocation) location).getLac(
);
MainActivity.this.networkType = MainActivity.this.tm.getNetw
orkType();
}
String networkOperator = MainActivity.this.tm.getNetworkOperator
();
if (networkOperator != null) {
MainActivity.this.mcc = Integer.parseInt(networkOperator.sub
string(0, 3));
MainActivity.this.mnc = Integer.parseInt(networkOperator.sub
string(3));
return;
}
return;
}
MainActivity.this.cellid = -1;
MainActivity.this.lac = -1;
MainActivity.this.networkType = -1;
MainActivity.this.mcc = -1;
MainActivity.this.mnc = -1;
}
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
switch (MainActivity.this.tm.getNetworkType()) {
case WearableExtender.SIZE_FULL_SCREEN /*5*/:
case FragmentManagerImpl.ANIM_STYLE_FADE_EXIT /*6*/:
case C0144R.styleable.Toolbar_titleMarginStart /*12*/:
MainActivity.this.signal = (float) signalStrength.getEvdoDbm
();
break;
default:
MainActivity.this.signal = (float) ((signalStrength.getGsmSi
gnalStrength() * 2) - 113);
break;
}
MainActivity.this.ecio = signalStrength.getEvdoEcio();
MainActivity.this.snr = signalStrength.getEvdoSnr();
MainActivity.this.errorBitRate = signalStrength.getGsmBitErrorRate()
;
MainActivity.this.networkType = MainActivity.this.tm.getNetworkType(
);
}
public void onCellInfoChanged(List<CellInfo> cellInfo) {
super.onCellInfoChanged(cellInfo);
}
try {
if (!file.exists()) {
file.createNewFile();
}
this.fileOutputStream = new FileOutputStream(file, true);
} catch (Exception e) {
}
System.currentTimeMillis();
this.tm = (TelephonyManager) this.ctx.getSystemService("phone");
this.am = (AudioManager) this.ctx.getSystemService("audio");
this.imei = this.tm.getDeviceId();
this.locationManager = (LocationManager) this.ctx.getSystemService("loca
tion");
registerListener();
this.txtStatus.setText(Environment.getExternalStoragePublicDirectory(Env
ironment.DIRECTORY_DOCUMENTS).getAbsolutePath());
}
protected void registerListener() {
this.tm.listen(new CallStateListener(), 32);
this.tm.listen(new CallStateListener(), 16);
this.tm.listen(new CallStateListener(), AccessibilityNodeInfoCompat.ACTI
ON_NEXT_AT_MOVEMENT_GRANULARITY);
this.tm.listen(new CallStateListener(), 1);
LocationListener listener = new C01421();
this.locationManager.requestLocationUpdates("gps", 0, 0.0f, listener);
this.locationManager.requestLocationUpdates("network", 0, 0.0f, listener
);
}
protected void onDestroy() {
try {
this.fileOutputStream.close();
} catch (Exception e) {
}
super.onDestroy();
}
protected void writeLog() {
if (this.callPlaced) {
this.endTime = 0;
}
try {
this.fileOutputStream.write((this.startTime + "," + this.endTime + "
," + this.callDuration + "," + 0 + "," + this.lat + "," + this.lng + "," + this.
speed + "," + this.accuracy + "," + this.signal + "," + this.mcc + "," + this.mn
c + "," + this.lac + "," + this.currentServiceState + "," + this.cellid + "," +
this.imei + "," + this.networkType + "," + this.ecio + "," + this.snr + "," + th
is.errorBitRate + "\n").getBytes());
} catch (Exception ex) {
Log.e("File Error", ex.getMessage());
}
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(C0144R.menu.menu_main, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == C0144R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void callNumber(View v) {
if (this.etIteration.getText().length() <= 0 || this.etNumber.getText().
length() <= 2 || this.etDuration.getText().length() <= 0) {
Toast.makeText(this, "Some fields are missing", 1).show();
return;
}
this.maxCount = Integer.parseInt(this.etIteration.getText().toString());
this.maxDuration = Integer.parseInt(this.etDuration.getText().toString()
);
this.callCount = 0;
startCalling();
}
public void startCalling() {
if (this.tm.getCallState() == 0) {
this.callPlaced = true;
Intent dial = new Intent("android.intent.action.CALL", Uri.parse("te
l:" + this.etNumber.getText()));
this.am.setBluetoothScoOn(false);
this.am.setSpeakerphoneOn(true);
this.am.setMicrophoneMute(true);
startActivity(dial);
}
}
public void disconnect(View v) {
if (this.countdown != null) {
this.countdown.cancel();
this.maxDuration = 0;
this.maxCount = 0;
callEnd();
return;
}
this.maxDuration = 0;
this.maxCount = 0;
callEnd();
}
public void callEnd() {
try {
Class<?> telephonyClass = Class.forName("com.android.internal.teleph
ony.ITelephony");
Class<?> telephonyStubClass = telephonyClass.getClasses()[0];
Class<?> serviceManagerClass = Class.forName("android.os.ServiceMana
ger");
Class<?> serviceManagerNativeClass = Class.forName("android.os.Servi
ceManagerNative");
String str = "getService";
Method getService = serviceManagerClass.getMethod(r17, new Class[]{S
tring.class});
str = "asInterface";
Method tempInterfaceMethod = serviceManagerNativeClass.getMethod(r17
, new Class[]{IBinder.class});
new Binder().attachInterface(null, "fake");