反射调用IWindowManager.dismissKeyguard,有意义吗

public void dismissKeyguard() {try {Class clsServiceManager = Class.forName("android.os.ServiceManager");Method getService = clsServiceManager.getMethod("getService",String.class);Object winService = getService.invoke(clsServiceManager,new Object[] { new String("window") });Class clsIWindowManager = Class.forName("android.view.IWindowManager");Class clsStub = Class.forName("android.view.IWindowManager$Stub");Method asInterface = clsStub.getMethod("asInterface", IBinder.class);Object objIWindowManager = asInterface.invoke(clsStub, winService);Class IWindowManger = Class.forName("android.view.IWindowManager");Method dismissKeyguard = IWindowManger.getMethod("dismissKeyguard");dismissKeyguard.invoke(objIWindowManager);} catch (NoSuchMethodException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (ClassNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalArgumentException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalAccessException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (InvocationTargetException e) {// TODO Auto-generated catch blocke.printStackTrace();}}

你可能感兴趣的:(反射调用IWindowManager.dismissKeyguard,有意义吗)