diff options
Diffstat (limited to 'core/java/android')
| -rwxr-xr-x | core/java/android/gesture/Gesture.java | 19 | ||||
| -rw-r--r-- | core/java/android/gesture/package.html | 2 | ||||
| -rw-r--r-- | core/java/android/os/Process.java | 6 | ||||
| -rw-r--r-- | core/java/android/provider/Settings.java | 11 | ||||
| -rw-r--r-- | core/java/android/server/search/Searchables.java | 7 | ||||
| -rw-r--r-- | core/java/android/webkit/WebSettings.java | 170 |
6 files changed, 192 insertions, 23 deletions
diff --git a/core/java/android/gesture/Gesture.java b/core/java/android/gesture/Gesture.java index 2262477..c92f665 100755 --- a/core/java/android/gesture/Gesture.java +++ b/core/java/android/gesture/Gesture.java @@ -57,11 +57,6 @@ public class Gesture implements Parcelable { mGestureID = GESTURE_ID_BASE + sGestureCount++; } - void recycle() { - mStrokes.clear(); - mBoundingBox.setEmpty(); - } - /** * @return all the strokes of the gesture */ @@ -162,20 +157,6 @@ public class Gesture implements Parcelable { } /** - * draw the gesture - * - * @param canvas - */ - void draw(Canvas canvas, Paint paint) { - final ArrayList<GestureStroke> strokes = mStrokes; - final int count = strokes.size(); - - for (int i = 0; i < count; i++) { - strokes.get(i).draw(canvas, paint); - } - } - - /** * Create a bitmap of the gesture with a transparent background * * @param width width of the target bitmap diff --git a/core/java/android/gesture/package.html b/core/java/android/gesture/package.html index a54a017..32c44d2 100644 --- a/core/java/android/gesture/package.html +++ b/core/java/android/gesture/package.html @@ -1,5 +1,5 @@ <HTML> <BODY> -@hide +Provides classes to create, recognize, load and save gestures. </BODY> </HTML> diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index 1214abc..51e6c1e 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -68,6 +68,12 @@ public class Process { public static final int PHONE_UID = 1001; /** + * Defines the UID/GID for the WIFI supplicant process. + * @hide + */ + public static final int WIFI_UID = 1010; + + /** * Defines the start of a range of UIDs (and GIDs), going from this * number to {@link #LAST_APPLICATION_UID} that are reserved for assigning * to applications. diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index aa583ac..6ed1ac8 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1328,7 +1328,7 @@ public final class Settings { * boolean (1 or 0). */ public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled"; - + /** * Whether live web suggestions while the user types into search dialogs are * enabled. Browsers and other search UIs should respect this, as it allows @@ -2300,7 +2300,7 @@ public final class Settings { * @hide */ public static final String BACKUP_TRANSPORT = "backup_transport"; - + /** * Version for which the setup wizard was last shown. Bumped for * each release when there is new setup information to show. @@ -2954,6 +2954,13 @@ public final class Settings { "vending_pd_resend_frequency_ms"; /** + * Frequency in milliseconds at which we should cycle through the promoted applications + * on the home screen or the categories page. + */ + public static final String VENDING_PROMO_REFRESH_FREQUENCY_MS = + "vending_promo_refresh_freq_ms"; + + /** * URL that points to the legal terms of service to display in Settings. * <p> * This should be a https URL. For a pretty user-friendly URL, use diff --git a/core/java/android/server/search/Searchables.java b/core/java/android/server/search/Searchables.java index b959907..c615957 100644 --- a/core/java/android/server/search/Searchables.java +++ b/core/java/android/server/search/Searchables.java @@ -247,7 +247,12 @@ public class Searchables { for (int i = 0; i < webSearchInfoList.size(); ++i) { ActivityInfo ai = webSearchInfoList.get(i).activityInfo; ComponentName component = new ComponentName(ai.packageName, ai.name); - newSearchablesForWebSearchList.add(newSearchablesMap.get(component)); + SearchableInfo searchable = newSearchablesMap.get(component); + if (searchable == null) { + Log.w(LOG_TAG, "did not find component in searchables: " + component); + } else { + newSearchablesForWebSearchList.add(searchable); + } } } diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index ec671d5..9f01923 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -16,15 +16,27 @@ package android.webkit; +import android.content.ContentValues; import android.content.Context; +import android.content.SharedPreferences; import android.os.Build; import android.os.Handler; import android.os.Message; +import android.preference.PreferenceManager; import android.provider.Checkin; +import android.provider.Settings; +import android.util.Log; +import java.io.File; import java.lang.SecurityException; + +import android.content.SharedPreferences.Editor; import android.content.pm.PackageManager; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteException; +import android.database.sqlite.SQLiteStatement; +import java.util.HashSet; import java.util.Locale; /** @@ -176,6 +188,43 @@ public class WebSettings { private boolean mBuiltInZoomControls = false; private boolean mAllowFileAccess = true; + // Donut-specific hack to keep Gears permissions in sync with the + // system location setting. + // TODO: Make sure this hack is removed in Eclair, when Gears + // is also removed. + // Used to remember if we checked the Gears permissions already. + static boolean mCheckedGearsPermissions = false; + // The Gears permissions database directory. + private final static String GEARS_DATABASE_DIR = "gears"; + // The Gears permissions database file name. + private final static String GEARS_DATABASE_FILE = "permissions.db"; + // The Gears location permissions table. + private final static String GEARS_LOCATION_ACCESS_TABLE_NAME = + "LocationAccess"; + // The Gears storage access permissions table. + private final static String GEARS_STORAGE_ACCESS_TABLE_NAME = "Access"; + // The Gears permissions db schema version table. + private final static String GEARS_SCHEMA_VERSION_TABLE_NAME = + "VersionInfo"; + // The shared pref name. + private static final String LAST_KNOWN_LOCATION_SETTING = + "lastKnownLocationSystemSetting"; + // The Browser package name. + private static final String BROWSER_PACKAGE_NAME = "com.android.browser"; + // The Google URLs whitelisted for Gears location access. + private static HashSet<String> sGearsWhiteList; + + static { + sGearsWhiteList = new HashSet<String>(); + // NOTE: DO NOT ADD A "/" AT THE END! + sGearsWhiteList.add("http://www.google.com"); + sGearsWhiteList.add("http://www.google.co.uk"); + } + + private static final String LOGTAG = "webcore"; + static final boolean DEBUG = false; + static final boolean LOGV_ENABLED = DEBUG; + // Class to handle messages before WebCore is ready. private class EventHandler { // Message id for syncing @@ -196,6 +245,7 @@ public class WebSettings { switch (msg.what) { case SYNC: synchronized (WebSettings.this) { + checkGearsPermissions(); if (mBrowserFrame.mNativeFrame != 0) { nativeSync(mBrowserFrame.mNativeFrame); } @@ -1163,6 +1213,126 @@ public class WebSettings { return size; } + private void checkGearsPermissions() { + // Did we already check the permissions? + if (mCheckedGearsPermissions) { + return; + } + // Are we running in the browser? + if (!BROWSER_PACKAGE_NAME.equals(mContext.getPackageName())) { + return; + } + // Is the pluginsPath sane? + if (mPluginsPath == null || mPluginsPath.length() == 0) { + // We don't yet have a meaningful plugin path, so + // we can't do anything about the Gears permissions. + return; + } + // Remember we checked the Gears permissions. + mCheckedGearsPermissions = true; + // Get the current system settings. + int setting = Settings.Secure.getInt(mContext.getContentResolver(), + Settings.Secure.USE_LOCATION_FOR_SERVICES, -1); + // Check if we need to set the Gears permissions. + if (setting != -1 && locationSystemSettingChanged(setting)) { + setGearsPermissionForGoogleDomains(setting); + } + } + + private boolean locationSystemSettingChanged(int newSetting) { + SharedPreferences prefs = + PreferenceManager.getDefaultSharedPreferences(mContext); + int oldSetting = 0; + oldSetting = prefs.getInt(LAST_KNOWN_LOCATION_SETTING, oldSetting); + if (oldSetting == newSetting) { + return false; + } + Editor ed = prefs.edit(); + ed.putInt(LAST_KNOWN_LOCATION_SETTING, newSetting); + ed.commit(); + return true; + } + + private void setGearsPermissionForGoogleDomains(int systemPermission) { + // Transform the system permission into a Gears permission + int gearsPermission = (systemPermission == 1 ? 1 : 2); + // Build the path to the Gears library. + + File file = new File(mPluginsPath).getParentFile(); + if (file == null) { + return; + } + // Build the Gears database file name. + file = new File(file.getAbsolutePath() + File.separator + + GEARS_DATABASE_DIR + File.separator + GEARS_DATABASE_FILE); + // Remember whether or not we need to create the LocationAccess table. + boolean needToCreateTables = !file.exists(); + // Try opening the Gears database. + SQLiteDatabase permissions; + try { + permissions = SQLiteDatabase.openOrCreateDatabase(file, null); + } catch (SQLiteException e) { + if (LOGV_ENABLED) { + Log.v(LOGTAG, "Could not open Gears permission DB: " + + e.getMessage()); + } + // Just bail out. + return; + } + // We now have a database open. Begin a transaction. + permissions.beginTransaction(); + try { + if (needToCreateTables) { + // Create the tables. Note that this creates the + // Gears tables for the permissions DB schema version 2. + // The Gears schema upgrade process will take care of the rest. + // First, the storage access table. + SQLiteStatement statement = permissions.compileStatement( + "CREATE TABLE IF NOT EXISTS " + + GEARS_STORAGE_ACCESS_TABLE_NAME + + " (Name TEXT UNIQUE, Value)"); + statement.execute(); + // Next the location access table. + statement = permissions.compileStatement( + "CREATE TABLE IF NOT EXISTS " + + GEARS_LOCATION_ACCESS_TABLE_NAME + + " (Name TEXT UNIQUE, Value)"); + statement.execute(); + // Finally, the schema version table. + statement = permissions.compileStatement( + "CREATE TABLE IF NOT EXISTS " + + GEARS_SCHEMA_VERSION_TABLE_NAME + + " (Name TEXT UNIQUE, Value)"); + statement.execute(); + // Set the schema version to 2. + ContentValues schema = new ContentValues(); + schema.put("Name", "Version"); + schema.put("Value", 2); + permissions.insert(GEARS_SCHEMA_VERSION_TABLE_NAME, null, + schema); + } + + ContentValues permissionValues = new ContentValues(); + + for (String url : sGearsWhiteList) { + permissionValues.put("Name", url); + permissionValues.put("Value", gearsPermission); + permissions.replace(GEARS_LOCATION_ACCESS_TABLE_NAME, null, + permissionValues); + permissionValues.clear(); + } + // Commit the transaction. + permissions.setTransactionSuccessful(); + } catch (SQLiteException e) { + if (LOGV_ENABLED) { + Log.v(LOGTAG, "Could not set the Gears permissions: " + + e.getMessage()); + } + } finally { + permissions.endTransaction(); + permissions.close(); + } + } /* Post a SYNC message to handle syncing the native settings. */ private synchronized void postSync() { // Only post if a sync is not pending |
