Browser setting the UA value

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.