- The code is as follows
/** * Androidusbcamera-master * Created by LZW on 2018/6/20. 10:53:22 * Email: [email protected] * All rights saved! Chongqing Anyun Tech Co. LTD */public class Shieldutil {public static final String Status_bar_service = "StatusBar"; public static final String Class_status_bar_manager = "Android.app.StatusBarManager"; public static final String method_disable = "DISABLE"; public static final String method_enable = "ENABLE"; public static void Hidekeys (context context) {try {@SuppressLint ("wrongconstant") Object service = Cont Ext.getsystemservice (Status_bar_service); class<?> Statusbarmanager = Class.forName (Class_status_bar_manager); Method disable = Statusbarmanager.getmethod (method_disable, int.class);//Disable.invoke (Servi CE, 0x00200000); Value for View.status_bar_disable_home//Disable.invoke (service, 0x00400000); is the value of View.status_bar_disable_back disable.invoke (service, 0x00200000|0x01000000); The value of View.status_bar_disable_recent} catch (Exception e) {e.printstacktrace (); }} public static void Showkeys (context context) {try {@SuppressLint ("wrongconstant") Object serv Ice = Context.getsystemservice (Status_bar_service); class<?> Statusbarmanager = Class.forName (Class_status_bar_manager); Method disable = Statusbarmanager.getmethod (method_disable, Int.class); Disable.invoke (service, 0x00000000|0x00000000); The value of View.status_bar_disable_recent} catch (Exception e) {e.printstacktrace (); } }}
- Note: can only be used under System permissions , that is, in Androidmanifest.xml
<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/ Android " android:shareduserid=" Android.uid.system " package=" Com.jiangdg.usbcamera ">
- Need to have permission
<uses-permission android:name= "Android.permission.EXPAND_STATUS_BAR"/>
- So it's decided that you can only have your own source code, not a custom Android device, that works.
Android Virtual keyboard disable with Enable