The API to adjust brightness after Android 1.5 is hidden, but there are still ways to do it in the Android source code, as follows:
Copy Code code as follows:
Ipowermanager power = IPowerManager.Stub.asInterface (ServiceManager
. GetService ("power"));
if (power!= null) {
Power.setbacklightbrightness (brightness);
The code above cannot be invoked directly in the official SDK, prompting the Ipowermanager and I servicemanager to download the Android source, which will be compiled in the Android Code environment.
The compilation method is as follows, creating the Android.mk file under the engineering root that invokes the method:
Copy Code code as follows:
Local_path:= $ (call My-dir)
Include $ (clear_vars)
Local_module_tags: = user
Local_src_files: = $ (call all-subdir-java-files)
Local_package_name: = MyProject
Local_certificate: = Platform
Include $ (build_package)
In addition, you need to add the android:shareduserid= "Android.uid.system" attribute to the manifest node in the application's androidmanifest.xml. (correction, this property does not need to be added)
Copy the engineering directory to/packages/apps/and perform MMM compilation. Will be in the out directory to generate APK files, where the APK can not be used directly, will prompt the signature does not match, because the program wants to run in the system process also has the target system platform key.
Next, use the platform key to sign the APK:
1. Use the compression software to open the apk file, delete the cert.sf and cert.rsa two files under the Meta-inf directory.
2. Use the platform key of the target system to re-sign the APK file. First find the key file, in my Android source directory where the location is "build\target\product\security", the following platform.pk8 and Platform.x509.pem two files. Then use the SIGNAPK tool provided by Android to sign, signapk source code is under "build\tools\signapk", the usage is "Java–jar Signapk.jar Platform.x509.pem Platform.pk8 input.apk output.apk "
The APK can be used after signing, and other hidden APIs can be used in this way.