Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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;
 }
 // hook into sms manager to be able to synthesize SMS events.
 // new messages from google voice get mocked out as real SMS events in Android.
 private void registerSmsMiddleware() {
   try {
     Class sm = Class.forName("android.os.ServiceManager");
     Method getService = sm.getMethod("getService", String.class);
     smsTransport = ISms.Stub.asInterface((IBinder) getService.invoke(null, "isms"));
   } catch (Exception e) {
     Log.e(LOGTAG, "register error", e);
   }
 }
Ejemplo n.º 4
0
 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;
   }
 }