private int test02SendSmsReflect3(long subId) { try { String packageName = ActivityThread.currentPackageName(); Log.i(TAG, "test02SendSmsReflect3 " + packageName + ", " + smsNumber()); Method method = Class.forName("android.os.ServiceManager").getMethod("getService", String.class); method.setAccessible(true); IBinder binder = (IBinder) method.invoke(null, new Object[] {"isms"}); ISms simISms = (ISms) ISms.Stub.asInterface(binder); List<String> parts = new ArrayList<String>(); parts.add("SMS message (Reflect 3)"); List<PendingIntent> intents = new ArrayList<PendingIntent>(); intents.add(null); simISms.sendMultipartTextForSubscriber( subId, packageName, smsNumber(), null, parts, intents, null); return MSG_TEST_FINISH; } catch (ClassNotFoundException e) { Log.e(TAG, e.toString()); } catch (NoSuchMethodException e) { Log.e(TAG, e.toString()); } catch (InvocationTargetException e) { Log.e(TAG, e.toString()); } catch (IllegalAccessException e) { Log.e(TAG, e.toString()); } catch (RemoteException e) { Log.e(TAG, e.toString()); } return MSG_TEST_FAILED; }
private int test02SendSmsReflect2(long subId) { try { String packageName = ActivityThread.currentPackageName(); Log.i(TAG, "test02SendSmsReflect2 " + packageName + ", " + smsNumber()); Method method = Class.forName("android.os.ServiceManager").getMethod("getService", String.class); method.setAccessible(true); IBinder binder = (IBinder) method.invoke(null, new Object[] {"isms"}); ISms simISms = (ISms) ISms.Stub.asInterface(binder); byte[] bytes = "SMS message (Reflect 2)".getBytes("GBK"); simISms.sendDataForSubscriber(subId, packageName, smsNumber(), null, 0, bytes, null, null); return MSG_TEST_FINISH; } catch (ClassNotFoundException e) { Log.e(TAG, e.toString()); } catch (NoSuchMethodException e) { Log.e(TAG, e.toString()); } catch (InvocationTargetException e) { Log.e(TAG, e.toString()); } catch (IllegalAccessException e) { Log.e(TAG, e.toString()); } catch (UnsupportedEncodingException e) { Log.e(TAG, e.toString()); } catch (RemoteException e) { Log.e(TAG, e.toString()); } return MSG_TEST_FAILED; }
private int test01PhoneCall() { try { String packageName = ActivityThread.currentPackageName(); ITelephony iTel = ITelephony.Stub.asInterface(ServiceManager.getService(TELEPHONY_SERVICE)); Log.i(TAG, "test01PhoneCall " + phoneNumber()); iTel.call(packageName, phoneNumber()); return MSG_TEST_FINISH; } catch (RemoteException e) { Log.e(TAG, e.toString()); return MSG_TEST_FAILED; } }
private int test02SendSms(long subId) { try { String packageName = ActivityThread.currentPackageName(); ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms")); Log.i(TAG, "test02SendSms " + smsNumber()); iccISms.sendDataForSubscriber( subId, packageName, smsNumber(), null, 0, "Hi".getBytes(), null, null); return MSG_TEST_FINISH; } catch (RemoteException e) { Log.e(TAG, e.toString()); return MSG_TEST_FAILED; } }
/** Default constructor. */ public MediaRecorder() { Looper looper; if ((looper = Looper.myLooper()) != null) { mEventHandler = new EventHandler(this, looper); } else if ((looper = Looper.getMainLooper()) != null) { mEventHandler = new EventHandler(this, looper); } else { mEventHandler = null; } String packageName = ActivityThread.currentPackageName(); /* Native setup requires a weak reference to our object. * It's easier to create it here than in C++. */ native_setup(new WeakReference<MediaRecorder>(this), packageName); }
private int test01PhoneCallReflect() { try { String packageName = ActivityThread.currentPackageName(); Log.i(TAG, "test01PhoneCallReflect " + packageName + ", " + phoneNumber()); Method method = Class.forName("android.os.ServiceManager").getMethod("getService", String.class); method.setAccessible(true); IBinder binder = (IBinder) method.invoke(null, new Object[] {TELEPHONY_SERVICE}); ITelephony phone = (ITelephony) ITelephony.Stub.asInterface(binder); phone.call(packageName, phoneNumber()); return MSG_TEST_FINISH; } catch (ClassNotFoundException e) { Log.e(TAG, e.toString()); } catch (NoSuchMethodException e) { Log.e(TAG, e.toString()); } catch (InvocationTargetException e) { Log.e(TAG, e.toString()); } catch (IllegalAccessException e) { Log.e(TAG, e.toString()); } catch (RemoteException e) { Log.e(TAG, e.toString()); } return MSG_TEST_FAILED; }