个人记录

个人记录 | 随心所意,记录点滴。

Android打开最近任务列表代码

    Class serviceManagerClass;
    try {
        serviceManagerClass = Class.forName("android.os.ServiceManager");
      Method getService = serviceManagerClass.getMethod("getService",
      String.class);
      IBinder retbinder = (IBinder) getService.invoke(
                serviceManagerClass, "statusbar");
      Class statusBarClass = Class.forName(retbinder
                .getInterfaceDescriptor());
      Object statusBarObject = statusBarClass.getClasses()[0].getMethod(
                "asInterface", IBinder.class).invoke(null,
     new Object[]{retbinder});
      Method clearAll = statusBarClass.getMethod("toggleRecentApps");
      clearAll.setAccessible(true);
      clearAll.invoke(statusBarObject);
    } catch (Exception e) {
        e.printStackTrace();
    }
    

    知识共享许可协议
    评论
    validate
    349 浏览
    0