diff options
author | PauloftheWest <paulofthewest@google.com> | 2014-08-13 14:43:46 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-12 23:14:49 +0000 |
commit | e1fd76a85bf86fe5cd6637d3fdfe6420283395ed (patch) | |
tree | 69ac398a944c21fc748d35f388eefe726b0776b5 /src/com/android/settings | |
parent | b51253cfed0796b20e03a104aaca4d8d3e2d3024 (diff) | |
parent | f8cdcbf19c2a1fc44f9227453a73f2dc2061eb09 (diff) | |
download | packages_apps_Settings-e1fd76a85bf86fe5cd6637d3fdfe6420283395ed.zip packages_apps_Settings-e1fd76a85bf86fe5cd6637d3fdfe6420283395ed.tar.gz packages_apps_Settings-e1fd76a85bf86fe5cd6637d3fdfe6420283395ed.tar.bz2 |
Merge "Revert "Add BT message access"" into lmp-dev
Diffstat (limited to 'src/com/android/settings')
5 files changed, 0 insertions, 195 deletions
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index a8e28df..e0ab5bc 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -72,7 +72,6 @@ import com.android.settings.applications.InstalledAppDetails; import com.android.settings.applications.ManageApplications; import com.android.settings.applications.ProcessStatsUi; import com.android.settings.bluetooth.BluetoothSettings; -import com.android.settings.bluetooth.MessageAccessSettings; import com.android.settings.dashboard.DashboardCategory; import com.android.settings.dashboard.DashboardSummary; import com.android.settings.dashboard.DashboardTile; @@ -238,7 +237,6 @@ public class SettingsActivity extends Activity AdvancedWifiSettings.class.getName(), SavedAccessPointsWifiSettings.class.getName(), BluetoothSettings.class.getName(), - MessageAccessSettings.class.getName(), SimSettings.class.getName(), TetherSettings.class.getName(), WifiP2pSettings.class.getName(), diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java index bbd86a1..3c62ba9 100755 --- a/src/com/android/settings/bluetooth/BluetoothSettings.java +++ b/src/com/android/settings/bluetooth/BluetoothSettings.java @@ -69,7 +69,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem private static final int MENU_ID_SCAN = Menu.FIRST; private static final int MENU_ID_RENAME_DEVICE = Menu.FIRST + 1; private static final int MENU_ID_SHOW_RECEIVED = Menu.FIRST + 2; - private static final int MENU_ID_MESSAGE_ACCESS = Menu.FIRST + 3; /* Private intent to show the list of received files */ private static final String BTOPP_ACTION_OPEN_RECEIVED_FILES = @@ -205,12 +204,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.add(Menu.NONE, MENU_ID_SHOW_RECEIVED, 0, R.string.bluetooth_show_received_files) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); - // Message Access API is still not finished, once completed we undo this check. - // Bug 16232864 - if (android.os.SystemProperties.get("show_bluetooth_message_access").equals("true")){ - menu.add(Menu.NONE, MENU_ID_MESSAGE_ACCESS, 0, R.string.bluetooth_show_message_access) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); - } super.onCreateOptionsMenu(menu, inflater); } @@ -232,14 +225,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem Intent intent = new Intent(BTOPP_ACTION_OPEN_RECEIVED_FILES); getActivity().sendBroadcast(intent); return true; - - case MENU_ID_MESSAGE_ACCESS: - if (getActivity() instanceof SettingsActivity) { - ((SettingsActivity) getActivity()).startPreferencePanel( - MessageAccessSettings.class.getCanonicalName(), null, - R.string.bluetooth_show_message_access, null, this, 0); - } - return true; } return super.onOptionsItemSelected(item); } @@ -377,7 +362,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem } } - @Override public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice, int bondState) { setDeviceListGroup(getPreferenceScreen()); removeAllDevices(); diff --git a/src/com/android/settings/bluetooth/MessageAccessSettings.java b/src/com/android/settings/bluetooth/MessageAccessSettings.java deleted file mode 100644 index 913357c..0000000 --- a/src/com/android/settings/bluetooth/MessageAccessSettings.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.bluetooth; - -import android.accounts.Account; -import android.accounts.AccountManager; -import android.app.ActivityManagerNative; -import android.content.Context; -import android.content.pm.PackageManager.NameNotFoundException; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.os.UserHandle; -import android.preference.SwitchPreference; -import android.preference.Preference; -import android.preference.PreferenceGroup; -import android.preference.PreferenceScreen; -import android.provider.SearchIndexableResource; -import android.util.Log; - -import com.android.settings.accounts.AuthenticatorHelper; -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; -import com.android.settings.Utils; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settings.search.Indexable; - -import java.util.ArrayList; -import java.util.List; - -public class MessageAccessSettings extends SettingsPreferenceFragment - implements AuthenticatorHelper.OnAccountsUpdateListener, Indexable { - private static final String TAG = "MessageAccessSettings"; - private static final String GMAIL_PACKAGE_NAME = "com.google.android.gm"; - private static final String EMAIL_PACKAGE_NAME = "com.google.android.email"; - - private Account[] mAccounts; - private UserHandle mUserHandle; - private PreferenceGroup mAvailableAccounts; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // TODO: Define behavior for managed profile. See: http://b/16287773 - mUserHandle = new UserHandle(UserHandle.myUserId()); - - addPreferencesFromResource(R.xml.bluetooth_message_access); - } - - @Override - public void onResume() { - super.onResume(); - initPreferences(); - } - - @Override - public void onAccountsUpdate(final UserHandle userHandle) { - mAccounts = AccountManager.get(getActivity()).getAccountsAsUser( - mUserHandle.getIdentifier()); - - final int mAccountsSize = mAccounts.length; - for (int i = 0; i < mAccountsSize; ++i){ - Log.d(TAG, String.format("account.type = %s\n", mAccounts[i].type)); - } - } - - /** - * Retrieves the email icon for a given account's email preference - * - * @param accountPref The user's account to retrieve the icon from. - * - * @return The drawable representing the icon of the user's email preference - **/ - private Drawable getIcon(AccountPreference accountPref){ - Drawable icon = null; - - // Currently only two types of icons are allowed. - final String packageName = accountPref.account.type.equals("com.google") - ? GMAIL_PACKAGE_NAME : EMAIL_PACKAGE_NAME; - - try{ - icon = getPackageManager().getApplicationIcon(packageName); - }catch(NameNotFoundException nnfe){ - icon = null; - } - - return icon; - } - - private void initPreferences() { - final PreferenceScreen preferenceScreen = getPreferenceScreen(); - mAvailableAccounts = (PreferenceGroup)preferenceScreen.findPreference("accounts"); - mAccounts = AccountManager.get(getActivity()).getAccountsAsUser( - mUserHandle.getIdentifier()); - - final int mAccountsSize = mAccounts.length; - for (int i = 0; i < mAccountsSize; ++i){ - AccountPreference accountPref = new AccountPreference(getActivity(), mAccounts[i]); - Drawable icon = getIcon(accountPref); - if (icon != null){ - accountPref.setIcon(icon); - } - mAvailableAccounts.addPreference(accountPref); - } - } - - private class AccountPreference extends SwitchPreference - implements Preference.OnPreferenceChangeListener{ - private Account account; - - AccountPreference(Context context, Account account){ - super(context); - this.account = account; - setTitle(account.type); - setSummary(account.name); - - setOnPreferenceChangeListener(this); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object val) { - if (preference instanceof AccountPreference){ - final AccountPreference accountPref = (AccountPreference) preference; - - if (((Boolean)val).booleanValue()){ - // Enable paired deviced to connect, fill in once API is available - Log.w(TAG, String.format( - "User has turned on '%s' for Bluetooth message access.", - accountPref.account.name)); - } else { - // Disable paired deviced to connect, fill in once API is available - Log.w(TAG, String.format( - "User has turned off '%s' for Bluetooth message access.", - accountPref.account.name)); - } - } - return true; - } - } - - public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider() { - @Override - public List<SearchIndexableResource> getXmlResourcesToIndex( - Context context, boolean enabled) { - List<SearchIndexableResource> indexables = new ArrayList<SearchIndexableResource>(); - SearchIndexableResource indexable = new SearchIndexableResource(context); - indexable.xmlResId = R.xml.bluetooth_message_access; - indexables.add(indexable); - return indexables; - } - }; -} diff --git a/src/com/android/settings/search/Ranking.java b/src/com/android/settings/search/Ranking.java index 1a08aa2..2c76002 100644 --- a/src/com/android/settings/search/Ranking.java +++ b/src/com/android/settings/search/Ranking.java @@ -30,7 +30,6 @@ import com.android.settings.WallpaperTypeSettings; import com.android.settings.WirelessSettings; import com.android.settings.accessibility.AccessibilitySettings; import com.android.settings.bluetooth.BluetoothSettings; -import com.android.settings.bluetooth.MessageAccessSettings; import com.android.settings.deviceinfo.Memory; import com.android.settings.fuelgauge.BatterySaverSettings; import com.android.settings.fuelgauge.PowerUsageSummary; @@ -94,7 +93,6 @@ public final class Ranking { // BT sRankMap.put(BluetoothSettings.class.getName(), RANK_BT); - sRankMap.put(MessageAccessSettings.class.getName(), RANK_BT); // SIM Cards sRankMap.put(SimSettings.class.getName(), RANK_SIM); diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java index 31dac7b..5108da3 100644 --- a/src/com/android/settings/search/SearchIndexableResources.java +++ b/src/com/android/settings/search/SearchIndexableResources.java @@ -33,7 +33,6 @@ import com.android.settings.WallpaperTypeSettings; import com.android.settings.WirelessSettings; import com.android.settings.accessibility.AccessibilitySettings; import com.android.settings.bluetooth.BluetoothSettings; -import com.android.settings.bluetooth.MessageAccessSettings; import com.android.settings.deviceinfo.Memory; import com.android.settings.fuelgauge.BatterySaverSettings; import com.android.settings.fuelgauge.PowerUsageSummary; @@ -97,13 +96,6 @@ public final class SearchIndexableResources { SimSettings.class.getName(), R.drawable.ic_sim_sd)); - sResMap.put(MessageAccessSettings.class.getName(), - new SearchIndexableResource( - Ranking.getRankForClassName(MessageAccessSettings.class.getName()), - NO_DATA_RES_ID, - MessageAccessSettings.class.getName(), - R.drawable.ic_settings_bluetooth2)); - sResMap.put(DataUsageSummary.class.getName(), new SearchIndexableResource( Ranking.getRankForClassName(DataUsageSummary.class.getName()), |