Merge "Add a provider call to get device friendly name." into jb-ub-mail-ur10

This commit is contained in:
Yu Ping Hu 2013-10-30 23:07:52 +00:00 committed by Android (Google) Code Review
commit 6ceae42b30
2 changed files with 17 additions and 0 deletions

View File

@ -130,6 +130,13 @@ public abstract class EmailContent {
public static Uri MAILBOX_MOST_RECENT_MESSAGE_URI;
public static Uri ACCOUNT_CHECK_URI;
/**
* String for both the EmailProvider call, and the key for the value in the response.
* TODO: Eventually this ought to be a device property, not defined by the app.
*/
public static String DEVICE_FRIENDLY_NAME = "deviceFriendlyName";
public static String PROVIDER_PERMISSION;
public static synchronized void init(Context context) {

View File

@ -44,6 +44,7 @@ import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler.Callback;
@ -1943,6 +1944,15 @@ public class EmailProvider extends ContentProvider {
public Bundle call(String method, String arg, Bundle extras) {
LogUtils.d(TAG, "EmailProvider#call(%s, %s)", method, arg);
// Handle queries for the device friendly name.
// TODO: This should eventually be a device property, not defined by the app.
if (TextUtils.equals(method, EmailContent.DEVICE_FRIENDLY_NAME)) {
final Bundle bundle = new Bundle(1);
// TODO: For now, just use the model name since we don't yet have a user-supplied name.
bundle.putString(EmailContent.DEVICE_FRIENDLY_NAME, Build.MODEL);
return bundle;
}
// Handle sync status callbacks.
if (TextUtils.equals(method, SYNC_STATUS_CALLBACK_METHOD)) {
updateSyncStatus(extras);