Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void test1() {
- try {
- Class ServiceManager = Class.forName("android.os.ServiceManager");
- Method getService_method = ServiceManager.getMethod("getService", new Class[]{String.class});
- System.out.println("ServiceManager="+ServiceManager);
- System.out.println("getService_method="+getService_method);
- IBinder b = (IBinder)getService_method.invoke(null, new Object[]{"network_management"});
- System.out.println("b="+b);
- Class stub = Class.forName("android.os.INetworkManagementService$Stub");
- System.out.println("stub="+stub);
- Method asInterface_method = stub.getMethod("asInterface", new Class[]{IBinder.class});
- System.out.println("asInterface_method="+asInterface_method);
- Object nw = asInterface_method.invoke(null, new Object[] {b});
- System.out.println("nw="+nw);
- Method startTethering_method = nw.getClass().getMethod("startTethering", new Class[]{String[].class});
- System.out.println("startTethering=" + startTethering_method);
- char [] bytes = { /* ここに送りたいコマンドを バイト列で記載する */ };
- String[] param1 = {new String(bytes)};
- startTethering_method.invoke(nw, new Object[] {param1});
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement