src/com/android/browser/BrowserActivity.java(3 / 2)

18 18
19 19 import com.google.android.googleapps.IGoogleLoginService;
20 20 import com.google.android.googlelogin.GoogleLoginServiceConstants;
21 import com.google.android.providers.GoogleSettings.Partner;
21 22
22 23 import android.app.Activity;
23 24 import android.app.ActivityManager;
… …
204 204 if (googleUser == null || !hostedUser.equals(googleUser)) {
205 205 String domain = hostedUser.substring(hostedUser.lastIndexOf('@')+1);
206 206 homepage = "http://www.google.com/m/a/" + domain + "?client=ms-" +
207 SystemProperties.get("persist.sys.com.google.clientid", "unknown");
207 Partner.getString(BrowserActivity.this.getContentResolver(), Partner.CLIENT_ID);
208 208 }
209 209 } catch (RemoteException ignore) {
210 210 // Login service died; carry on
… …
4486 4486 R.string.google_search_base, l.getLanguage(),
4487 4487 l.getCountry().toLowerCase())
4488 4488 + "client=ms-"
4489 + SystemProperties.get("persist.sys.com.google.clientid", "unknown")
4489 + Partner.getString(this.getContentResolver(), Partner.CLIENT_ID)
4490 4490 + "&source=android-" + GOOGLE_SEARCH_SOURCE_SUGGEST + "&q=%s";
4491 4491 } else {
4492 4492 QuickSearch_G = url;

src/com/android/browser/BrowserProvider.java(11 / 11)

16 16
17 17 package com.android.browser;
18 18
19 import com.google.android.providers.GoogleSettings.Partner;
19 20 import java.util.Date;
20 21
21 22 import android.app.ISearchManager;
… …
24 24 import android.content.ComponentName;
25 25 import android.content.ContentProvider;
26 26 import android.content.ContentUris;
27 import android.content.ContentResolver;
27 28 import android.content.ContentValues;
28 29 import android.content.Context;
29 30 import android.content.Intent;
… …
45 45 import android.server.search.SearchableInfo;
46 46 import android.text.util.Regex;
47 47
48
48 49 public class BrowserProvider extends ContentProvider {
49 50
50 51 private SQLiteOpenHelper mOpenHelper;
… …
137 137 }
138 138
139 139
140 private static CharSequence replaceSystemPropertyInString(CharSequence srcString) {
140 private static CharSequence replaceSystemPropertyInString(Context context, CharSequence srcString) {
141 141 StringBuffer sb = new StringBuffer();
142 142 int lastCharLoc = 0;
143
144 final String client_id = Partner.getString(context.getContentResolver(), Partner.CLIENT_ID);
145
143 146 for (int i = 0; i < srcString.length(); ++i) {
144 147 char c = srcString.charAt(i);
145 148 if (c == '{') {
… …
153 153 char k = srcString.charAt(j);
154 154 if (k == '}') {
155 155 String propertyKeyValue = srcString.subSequence(i + 1, j).toString();
156 // See if the propertyKeyValue specifies a default value
157 int defaultOffset = propertyKeyValue.indexOf(':');
158 if (defaultOffset == -1) {
159 sb.append(SystemProperties.get(propertyKeyValue));
156 if (propertyKeyValue.equals("CLIENT_ID")) {
157 sb.append(client_id);
160 158 } else {
161 String propertyKey = propertyKeyValue.substring(0, defaultOffset);
162 String defaultValue =
163 propertyKeyValue.substring(defaultOffset + 1,
164 propertyKeyValue.length());
165 sb.append(SystemProperties.get(propertyKey, defaultValue));
159 sb.append("unknown");
166 160 }
167 161 lastCharLoc = j + 1;
168 162 i = j;
… …
199 199 int size = bookmarks.length;
200 200 try {
201 201 for (int i = 0; i < size; i = i + 2) {
202 CharSequence bookmarkDestination = replaceSystemPropertyInString(bookmarks[i + 1]);
202 CharSequence bookmarkDestination = replaceSystemPropertyInString(mContext, bookmarks[i + 1]);
203 203 db.execSQL("INSERT INTO bookmarks (title, url, visits, " +
204 204 "date, created, bookmark)" + " VALUES('" +
205 205 bookmarks[i] + "', '" + bookmarkDestination +

src/com/android/browser/BrowserSettings.java(7 / 2)

16 16
17 17 package com.android.browser;
18 18
19 import com.google.android.providers.GoogleSettings.Partner;
20
19 21 import android.app.Activity;
20 22 import android.content.ContentResolver;
21 23 import android.content.Context;
… …
67 67 private boolean saveFormData = true;
68 68 private boolean openInBackground = false;
69 69 private String defaultTextEncodingName;
70 private String homeUrl = "http://www.google.com/m?client=ms-" +
71 SystemProperties.get("persist.sys.com.google.clientid", "unknown");
70 private String homeUrl = "http://www.google.com/m?client=ms-";
72 71 private boolean loginInitialized = false;
73 72 private boolean autoFitPage = true;
74 73 private boolean showDebugSettings = false;
… …
199 199 // local directory.
200 200 pluginsPath = ctx.getDir("plugins", 0).getPath();
201 201
202 homeUrl += Partner.getString(ctx.getContentResolver(), Partner.CLIENT_ID);
203
202 204 // Load the defaults from the xml
203 205 // This call is TOO SLOW, need to manually keep the defaults
204 206 // in sync
… …
209 209 }
210 210
211 211 /* package */ void syncSharedPreferences(SharedPreferences p) {
212
212 213 homeUrl =
213 214 p.getString(PREF_HOMEPAGE, homeUrl);
215
214 216 loadsImagesAutomatically = p.getBoolean("load_images",
215 217 loadsImagesAutomatically);
216 218 javaScriptEnabled = p.getBoolean("enable_javascript",

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 神器 MdNice !
  2. 编程指北
  3. GitHub 全球排名第 36 的辣个男人!
  4. 元旦发几个大红包
  5. 扑克牌魔术里面的算法
  6. 使用pm2后台运行nodejs程序
  7. Android性能优化案例研究(上)
  8. 一个正确的编程学习方法
  9. 速成编程、副业挣钱有无可能?
  10. 我总是半途而废