2013年12月4日星期三

How to Android Settings Setting the default option

Such as the title , now transplanted Android4.2.2, the need to achieve the developers in setting the default boot option checked Disable HW overlays options how to achieve ? You can now search to a method similar to the following :
If you want to modify the default values ​​loaded at boot
modify SettingsProvider defaults , Settings to configure various settings of the Android system , the default values ​​for these settings are the frameworks of the SettingsProvider read from the database, then the first boot , when these data are from where did they come from?
frameworks / base / packages / SettingsProvider / res / values ​​/ defaults.xml

This file is used to store default settings for the Android system
For example:
600000 Set Default off screen timeout
102 Set Default brightness
false settings are the default values ​​to install non- Market applications allow
If you want to define defaults.xml not in , after adding in here , you need to modify
frameworks / base / packages / SettingsProvider / src / com / android / providers / settings / DatabaseHelper.java, add your own storage code.
read from the database that can not be achieved on the first boot is checked by default Disable HW overlays, and defaults.xml, no staff on the development of content options , how to add ?
------ Solution ---------------------------------------- ----
himself in to add a loadStringSettings DatabaseHelper to initialize Disable HW overlays
------ Solution -------------------- ------------------------
looked under HWC this thing is not using settingsprovider store. . . . . .
you how to write database which will not be called to . . . . . .
frameworks / native / services / surfaceflinger / SurfaceFlinger.cpp in

mDebugDisableHWC (0), you put the words into an initial try
------ eference -------------------- -------------------

SQLiteStatement stmt = null;
try {
stmt = db.compileStatement ("INSERT INTO ; system (name, value) "
+ "VALUES (,??);");
loadBooleanSetting (stmt, Settings.System.NOTIFICATION_LIGHT_PULSE ,
R.bool.def_ notification_pulse );
db.setTransactionSuccessful ();
} finally {
db.endTransaction ();
if (stmt! = null) stmt . close ();
}
modify the code above the red part can define your own fields , the blue part of the developer the option corresponding Disable HW overlays field how to determine ?
------ eference --------------------------------------- < br>
great! Indeed such a change , aSysBang how you are positioned to Disable HW overlays SurfaceFlinger.cpp mDebugDisableHWC (0) it ?

没有评论:

发表评论