blob: 2dad21a48fa19e0deb5977d3e5017961e765c70e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.distribution;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
/**
* Client for accessing data from Android's "partner browser customizations" content provider.
*/
public class PartnerBrowserCustomizationsClient {
private static final Uri CONTENT_URI = Uri.parse("content://com.android.partnerbrowsercustomizations");
private static final Uri HOMEPAGE_URI = CONTENT_URI.buildUpon().path("homepage").build();
private static final String COLUMN_HOMEPAGE = "homepage";
/**
* Returns the partner homepage or null if it could not be read from the content provider.
*/
public static String getHomepage(Context context) {
Cursor cursor = context.getContentResolver().query(
HOMEPAGE_URI, new String[] { COLUMN_HOMEPAGE }, null, null, null);
if (cursor == null) {
return null;
}
try {
if (!cursor.moveToFirst()) {
return null;
}
return cursor.getString(cursor.getColumnIndexOrThrow(COLUMN_HOMEPAGE));
} finally {
cursor.close();
}
}
}
|