Use a secure setting for default browser geolocation permissions
Partly reverts I6308b476ad18b1d71d7438b936c592a45365c9f0 Bug: http://b/issue?id=2535598 Change-Id: Ib488c6d4f10a87b714ecb78eef6fe58f572907c6
This commit is contained in:
@@ -1233,17 +1233,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="WRITE_GEOLOCATION_PERMISSIONS"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value=""com.android.browser.permission.WRITE_GEOLOCATION_PERMISSIONS""
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="WRITE_GSERVICES"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
@@ -124196,21 +124185,6 @@
|
||||
<parameter name="search" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="allowGeolocation"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="true"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="cr" type="android.content.ContentResolver">
|
||||
</parameter>
|
||||
<parameter name="origin" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="canClearHistory"
|
||||
return="boolean"
|
||||
abstract="false"
|
||||
@@ -124224,21 +124198,6 @@
|
||||
<parameter name="cr" type="android.content.ContentResolver">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="clearGeolocation"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="true"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="cr" type="android.content.ContentResolver">
|
||||
</parameter>
|
||||
<parameter name="origin" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="clearHistory"
|
||||
return="void"
|
||||
abstract="false"
|
||||
@@ -124438,16 +124397,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="GEOLOCATION_URI"
|
||||
type="android.net.Uri"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="HISTORY_PROJECTION"
|
||||
type="java.lang.String[]"
|
||||
transient="false"
|
||||
@@ -124720,34 +124669,6 @@
|
||||
>
|
||||
</field>
|
||||
</class>
|
||||
<class name="Browser.GeolocationColumns"
|
||||
extends="java.lang.Object"
|
||||
abstract="false"
|
||||
static="true"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<constructor name="Browser.GeolocationColumns"
|
||||
type="android.provider.Browser.GeolocationColumns"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</constructor>
|
||||
<field name="ORIGIN"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value=""origin""
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
</class>
|
||||
<class name="Browser.SearchColumns"
|
||||
extends="java.lang.Object"
|
||||
abstract="false"
|
||||
@@ -135935,6 +135856,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="ALLOWED_GEOLOCATION_ORIGINS"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value=""allowed_geolocation_origins""
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="ALLOW_MOCK_LOCATION"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
|
||||
@@ -120,15 +120,6 @@ public class Browser {
|
||||
get them. */
|
||||
private static final int MAX_HISTORY_COUNT = 250;
|
||||
|
||||
/**
|
||||
* URI for writing geolocation permissions. This requires the
|
||||
* {@link android.Manifest.permission#WRITE_GEOLOCATION_PERMISSIONS}.
|
||||
*/
|
||||
public static final Uri GEOLOCATION_URI =
|
||||
Uri.parse("content://browser/geolocation");
|
||||
|
||||
private static final String GEOLOCATION_WHERE_CLAUSE = GeolocationColumns.ORIGIN + " = ?";
|
||||
|
||||
/**
|
||||
* Open the AddBookmark activity to save a bookmark. Launch with
|
||||
* and/or url, which can be edited by the user before saving.
|
||||
@@ -614,42 +605,6 @@ public class Browser {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows geolocation for the specified origin.
|
||||
* This requires the {@link android.Manifest.permission#WRITE_GEOLOCATION_PERMISSIONS}
|
||||
* permission.
|
||||
*
|
||||
* @param origin The origin to allow geolocation for, e.g. "http://www.google.com". The string
|
||||
* should not include a trailing slash.
|
||||
*/
|
||||
public static void allowGeolocation(ContentResolver cr, String origin) {
|
||||
try {
|
||||
ContentValues map = new ContentValues();
|
||||
map.put(GeolocationColumns.ORIGIN, origin);
|
||||
cr.insert(GEOLOCATION_URI, map);
|
||||
} catch (IllegalStateException e) {
|
||||
Log.e(LOGTAG, "allowGeolocation", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the geolocation permission state for the specified origin.
|
||||
* This requires the {@link android.Manifest.permission#WRITE_GEOLOCATION_PERMISSIONS}
|
||||
* permission.
|
||||
*
|
||||
* @param origin The origin to allow geolocation for, e.g. "http://www.google.com". The string
|
||||
* should not include a trailing slash.
|
||||
*/
|
||||
public static void clearGeolocation(ContentResolver cr, String origin) {
|
||||
try {
|
||||
String[] whereArgs = { origin };
|
||||
cr.delete(GEOLOCATION_URI, GEOLOCATION_WHERE_CLAUSE, whereArgs);
|
||||
} catch (IllegalStateException e) {
|
||||
Log.e(LOGTAG, "clearGeolocation", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static class BookmarkColumns implements BaseColumns {
|
||||
public static final String URL = "url";
|
||||
public static final String VISITS = "visits";
|
||||
@@ -677,8 +632,4 @@ public class Browser {
|
||||
public static final String SEARCH = "search";
|
||||
public static final String DATE = "date";
|
||||
}
|
||||
|
||||
public static class GeolocationColumns {
|
||||
public static final String ORIGIN = "origin";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2629,6 +2629,13 @@ public final class Settings {
|
||||
*/
|
||||
public static final String BACKGROUND_DATA = "background_data";
|
||||
|
||||
/**
|
||||
* Origins for which browsers should allow geolocation by default.
|
||||
* The value is a space-separated list of origins.
|
||||
*/
|
||||
public static final String ALLOWED_GEOLOCATION_ORIGINS
|
||||
= "allowed_geolocation_origins";
|
||||
|
||||
/**
|
||||
* Whether mobile data connections are allowed by the user. See
|
||||
* ConnectivityManager for more info.
|
||||
@@ -2709,14 +2716,6 @@ public final class Settings {
|
||||
*/
|
||||
public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
|
||||
|
||||
/**
|
||||
* Flag for allowing service provider to use location information to improve products and
|
||||
* services.
|
||||
* Type: int ( 0 = disallow, 1 = allow )
|
||||
* @hide
|
||||
*/
|
||||
public static final String USE_LOCATION_FOR_SERVICES = "use_location";
|
||||
|
||||
/**
|
||||
* Controls whether settings backup is enabled.
|
||||
* Type: int ( 0 = disabled, 1 = enabled )
|
||||
|
||||
@@ -250,14 +250,6 @@
|
||||
android:description="@string/permdesc_writeHistoryBookmarks"
|
||||
android:protectionLevel="dangerous" />
|
||||
|
||||
<!-- Allows an application to write to (but not read) the user's
|
||||
geolocation permissions.. -->
|
||||
<permission android:name="com.android.browser.permission.WRITE_GEOLOCATION_PERMISSIONS"
|
||||
android:permissionGroup="android.permission-group.LOCATION"
|
||||
android:label="@string/permlab_writeGeolocationPermissions"
|
||||
android:description="@string/permdesc_writeGeolocationPermissions"
|
||||
android:protectionLevel="signatureOrSystem" />
|
||||
|
||||
<!-- ======================================= -->
|
||||
<!-- Permissions for accessing location info -->
|
||||
<!-- ======================================= -->
|
||||
|
||||
Reference in New Issue
Block a user