The Optionmenu in the SWE browser is displayed by the controller through onkeydown monitoring keycode_menu.
public boolean OnKeyDown (int KeyCode, KeyEvent event) { if (keycode = = KeyEvent. keycode_menu && Event.getrepeatcount () = = 0 // Hardware Menu key Mappmenuhandl Er. showappmenu (Mactivity.findviewbyid (R.id.taburlbar), true , false ); return true ; }
New This r.menu.browser);
View "about" menu processing, engine.getdefaultuseragent () to get UA values. It looks like you can't change the UA value directly. (A string re-assignment is not possible through A-ku test because the UA is not written to the system)
CaseR.id.about_menu_id:bundle Bundle=NewBundle (); LOG.I ("Antoon", "engine.getdefaultuseragent =" +engine.getdefaultuseragent ()); Bundle.putcharsequence ("UA", engine.getdefaultuseragent ()); //org.codeaurora.swe. The Engine seems to be out of reach bundle.putcharsequence ("Tabtitle", Mtabcontrol.getcurrenttab (). GetTitle ()); Bundle.putcharsequence ("TabURL", Mtabcontrol.getcurrenttab (). GETURL ()); Browserpreferencespage.startpreferencefragmentextraforresult (mactivity, aboutpreferencesfragment.
class. GetName (), bundle, 0); Break;
------------------------------------------
in Org.codeaurora.swe.Engine
Public Static String getdefaultuseragent () { return awsettings.getdefaultuseragent (); Org.chromium.android_webview. awsettings looks even more unreachable}
And then search for this to change the C + +, for do not understand C seems unable to change.
And then found com.android.browser. UA can be customized in browserconfigbase , and the complete set-up method is provided in browser without worrying about UA writing to the underlying processing.
Public voidoverrideuseragent () {//Check If the UA is already present using command line file if(Browsercommandline.hasswitch (override_user_agent)) {return; } //String ua = Mcontext.getresources (). getString (r.string.def_useragent);//source default with R.string.def_useragent configurationString ua =Settings.System.getString (Mcontext.getcontentresolver (), UA); //I changed to read Settings.system database configuration if(Textutils.isempty (UA))return; UA=constructuseragent (UA); if(!Textutils.isempty (UA)) { browsercommandline. Appendswitchwithvalue (Override_user_agent, UA); This writes UA to the System }}
--------------------------------------------
Org.codeaurora.swe.BrowserCommandLine
Public Static void Appendswitchwithvalue (String switchstring, String value) { commandline.getinstance (). Appendswitchwithvalue (switchstring, value); //org.chromium.base. CommandLine }
and the above Org.chromium.android_webview. Awsettings get UA In the same vein, the Org.chromium.base.CommandLine setting UA value is also written to the C + + layer.
Called when browser initiates initialization, so engine.getdefaultuseragent () gets the custom UA .
Browser setting the UA value