Android7.0 MTK 需求文档(一)
来源:互联网 发布:ipython 源码下载 编辑:程序博客网 时间:2024/06/05 00:31
一:信号图标,3G改为H,G改为E
(frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java)
static final MobileIconGroup THREE_G = new MobileIconGroup(- "3G",+ "H", TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH, TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH, AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,@@ -282,10 +282,10 @@ class TelephonyIcons { TelephonyIcons.TELEPHONY_NO_NETWORK, TelephonyIcons.QS_TELEPHONY_NO_NETWORK, AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],- R.string.accessibility_data_connection_3g,- TelephonyIcons.ICON_3G,+ R.string.accessibility_data_connection_3_5g,+ TelephonyIcons.ICON_H, true,- TelephonyIcons.QS_DATA_3G+ TelephonyIcons.QS_DATA_H ); static final MobileIconGroup WFC = new MobileIconGroup(@@ -343,7 +343,7 @@ class TelephonyIcons { ); static final MobileIconGroup G = new MobileIconGroup(- "G",+ "E", TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH, TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH, AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,@@ -351,10 +351,10 @@ class TelephonyIcons { TelephonyIcons.TELEPHONY_NO_NETWORK, TelephonyIcons.QS_TELEPHONY_NO_NETWORK, AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],- R.string.accessibility_data_connection_gprs,- TelephonyIcons.ICON_G,+ R.string.accessibility_data_connection_edge,+ TelephonyIcons.ICON_E, false,- TelephonyIcons.QS_DATA_G+ TelephonyIcons.QS_DATA_E ); static final MobileIconGroup H = new MobileIconGroup(
二:添加可选的网络 3G
(services/Telephony/src/com/android/phone/MobileNetworkSettings.java)
mButtonEnabledNetworks.setSummary(R.string.network_3G); break; case Phone.NT_MODE_WCDMA_ONLY:+ mButtonEnabledNetworks.setValue(Integer.toString(Phone.NT_MODE_WCDMA_ONLY));+ mButtonEnabledNetworks.setSummary(R.string.network_3G_only);+ break; case Phone.NT_MODE_GSM_UMTS: case Phone.NT_MODE_WCDMA_PREF: if (!mIsGlobalCdma) {(services/Telephony/res/values/strings.xml)
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="network_3G">GSM/WCDMA (Auto)</string> <string name="network_3G_only">Only WCDMA</string> <string name="network_2G">Only GSM</string> <string-array name="enabled_networks_4g_choices" translatable="false"> <item>@string/network_4G</item> <item>@string/network_3G</item> <item>@string/network_3G_only</item> <item>@string/network_2G</item> </string-array> <!-- 网络优先级 --> <string-array name="enabled_networks_values" translatable="false"> <item>"9"</item> <item>"0"</item> <item>"2"</item> <item>"1"</item> </string-array></resources>
三:语言列表中只保留English,Spanish,French,中文
(除了常规的宏里配置VANZO_PRODUCT_LOCALES=es_ES zh_CN fr_FR en_US,还需在frameworks/base/core/res/res/values/locale_config.xml 中删除不要的语言)
四:更改Google默认打开输入法
(packages/inputmethods/)
(LatinIME/java/Android.mk)
LOCAL_PACKAGE_NAME := LatinIME -LOCAL_CERTIFICATE := shared+LOCAL_CERTIFICATE := platform LOCAL_JNI_SHARED_LIBRARIES := libjni_latinime @@ -34,7 +34,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ android-common inputmethod-common android-support-v4 jsr305 latinime-common -+LOCAL_PRIVILEGED_MODULE := true # Do not compress dictionary files to mmap dict data runtime LOCAL_AAPT_FLAGS := -0 .dict
(LatinIME/java/AndroidManifest.xml)
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />+ <uses-permission android:name="android.permission.WRITE_SETTINGS" />+ <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> <application android:label="@string/english_ime_name" android:icon="@drawable/ic_launcher_keyboard"@@ -164,6 +166,12 @@ </intent-filter> </receiver> + <receiver android:name="LatinImeRe" android:enabled="true">+ <intent-filter>+ <action android:name="android.intent.action.BOOT_COMPLETED" />+ </intent-filter>+ </receiver>+ <!-- Content providers --> <provider android:name="com.android.inputmethod.dictionarypack.DictionaryProvider" android:grantUriPermissions="true"
(LatinIME/java/src/com/android/inputmethod/latin/LatinImeRe.java)
+package com.android.inputmethod.latin;++import android.content.BroadcastReceiver;+import android.content.Context;+import android.content.Intent;+import android.content.SharedPreferences;+import android.provider.Settings;+import android.util.Log;+import android.view.inputmethod.InputMethodInfo;+import android.view.inputmethod.InputMethodManager;+import android.view.inputmethod.InputMethodSubtype;++import android.text.TextUtils;++public class LatinImeRe extends BroadcastReceiver {++ private static final String TAG = "LatinImeRe";++ @Override+ public void onReceive(Context context, Intent intent) {+ // Set the default input language at the system boot completed.+ if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {+ Log.w(TAG, "onReceive");+ SharedPreferences sp = context.getSharedPreferences("default_input_language_config",+ Context.MODE_PRIVATE);+ boolean hasSet = sp.getBoolean("has_set", false);++ setDefaultSubtypes(context);+ sp.edit().putBoolean("has_set", true).commit();+ }+ }+ /**+ * M: Set the default IME subtype.+ */+ private void setDefaultSubtypes(Context context) {+ final String serviceName = "com.android.inputmethod.latin/.LatinIME";+ final String currentPackageName = "com.android.inputmethod.latin";+ final String enable = Settings.Secure.getString(context.getContentResolver(),+ Settings.Secure.ENABLED_INPUT_METHODS);++ Log.w(TAG, "setDefaultSubtypes() enable :" + enable);++ final InputMethodManager imm = (InputMethodManager) context.getSystemService(+ Context.INPUT_METHOD_SERVICE);+ final StringBuilder builder = new StringBuilder();++ // Get sub type hash code+ for (InputMethodInfo info : imm.getInputMethodList()) {+ if (currentPackageName.equals(info.getPackageName())) {+ for (int i = 0; i < info.getSubtypeCount(); i++) {+ final InputMethodSubtype subtype = info.getSubtypeAt(i);+ final String locale = subtype.getLocale().toString();+ //winny+ Log.w(TAG, "subtype.getLocale().toString :" + locale);++ if (isDefaultLocale(locale)) {+ Log.i(TAG, "default enabled subtype locale = " + locale);+ builder.append(';');+ builder.append(subtype.hashCode());+ }+ }++ break;+ }+ }++ Log.w(TAG, "after for loop :" + builder.toString());+ // Insert the sub type+ if (builder.length() > 0) {+ final String subtype = builder.toString();+ builder.setLength(0);++ final int index = enable.indexOf(serviceName) + serviceName.length();+ if (enable.length() > index) {+ builder.append(enable.substring(0, index));+ builder.append(subtype);+ builder.append(enable.substring(index));+ } else if (enable.length() == index) {+ builder.append(enable);+ builder.append(subtype);+ } else {+ return;+ }+ }++ // Commit the result+ android.provider.Settings.Secure.putString(context.getContentResolver(),+ android.provider.Settings.Secure.ENABLED_INPUT_METHODS, builder.toString());+ }+ /**+ * M: Check if the current locale is default or not.+ */+ private boolean isDefaultLocale (String locale) {++ String[] locales= new String[]{"es"};+ //将默认的语言在此添加,注意写法与method.xml中的subtype语言保持一致,这里es是西班牙语的示例。+ for (String s : locales) {+ if (s.equals(locale)) {+ return true;+ }+ }++ return false;++ }+}
五:收到短信时,手机无振动
(vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/transaction/MessagingNotification.java)
*/ /// M: comment if, change condition //if (vibrateAlways || vibrateSilent && nowSilent) {- if (notiProf.needVibrate()- && audioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_NOTIFICATION)) {+ if (notiProf.needVibrate()) { defaults |= Notification.DEFAULT_VIBRATE; } /// @}@@ -1471,6 +1470,11 @@ public class MessagingNotification { } } }+ PowerManager mPowerManager = (PowerManager) (context.getSystemService(Context.POWER_SERVICE));+ PowerManager.WakeLock mWakeLock = null;+ mWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP+ | PowerManager.ON_AFTER_RELEASE, "MMS_wake_lock");+ mWakeLock.acquire(5000); nm.notify(NOTIFICATION_ID, notification); // add for OP
六:个别SIM卡在搜索网络的时候 4G/3G/2G 前面显示的是null
(frameworks/opt/telephony/src/java/com/android/internal/telephony/RIL.java)
(mSimOperatorNumeric.equals(strings[i + 2]))) { String sCphsOns = null; sCphsOns = simRecord.getSIMCPHSOns();- if (sCphsOns != null) {+ if (sCphsOns != null && !sCphsOns.equals("")) { strings[i + 0] = sCphsOns; Rlog.d(RILJ_LOG_TAG, "plmn name update to CPHS Ons: " + strings[i + 0]);
七:去除信号图标 X
(frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java)
static final int ICON_CARRIER_NETWORK_CHANGE = R.drawable.stat_sys_signal_carrier_network_change_animation; - static final int ICON_DATA_DISABLED = R.drawable.stat_sys_data_disabled;+ static final int ICON_DATA_DISABLED = -1; static final int QS_ICON_LTE = R.drawable.ic_qs_signal_lte; static final int QS_ICON_3G = R.drawable.ic_qs_signal_3g;@@ -256,7 +256,7 @@ class TelephonyIcons { static final int QS_ICON_CARRIER_NETWORK_CHANGE = R.drawable.ic_qs_signal_carrier_network_change_animation; - static final int QS_ICON_DATA_DISABLED = R.drawable.ic_qs_data_disabled;+ static final int QS_ICON_DATA_DISABLED = -1; static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup( "CARRIER_NETWORK_CHANGE",(packages/apps/Settings/src/com/android/settings/dashboard/conditional/CellularDataCondition.java)
@Override public Icon getIcon() {- return Icon.createWithResource(mManager.getContext(), R.drawable.ic_cellular_off);+ return Icon.createWithResource(mManager.getContext(), -1); } @Override
八:拨打语音信箱时显示 @@@@@@@@@@@@@@
(packages/apps/Dialer/InCallUI/src/com/android/incallui/ContactInfoCache.java)
// later determine whether to use the name or nameAlternative when presenting displayName = info.name; cce.nameAlternative = info.nameAlternative;+ if ( displayName !=null && displayName.equals("@@@@@@@@@@@@@@")) {+ displayName = context.getResources().getString(R.string.voicemail) ;+ } displayNumber = number; label = info.phoneLabel; Log.d(TAG, " ==> name is present in CallerInfo: displayName '" + displayName
九:sim卡1打开数据网络切换sim卡2,数据网络要跟随开打
(packages/apps/Settings/src/com/android/settings/sim/SimDialogActivity.java)
final SubscriptionManager subscriptionManager = SubscriptionManager.from(context); /// M: for plug-in, need to call before setDefaultDataSubId mSimManagementExt.setDataState(subId);- subscriptionManager.setDefaultDataSubId(subId);+ TelephonyManager telephonyManager = TelephonyManager.from(context);+ boolean enableBefore = telephonyManager.getDataEnabled();+ int preSubId = subscriptionManager.getDefaultDataSubscriptionId();+ Log.d(TAG, "data flag: " + enableBefore + ", subId: " + subId + ", preSubId: " + preSubId);+ if (subscriptionManager.isValidSubscriptionId(subId) &&subId != preSubId) {+ subscriptionManager.setDefaultDataSubId(subId);+ if (enableBefore) {+ telephonyManager.setDataEnabled(subId, true);+ telephonyManager.setDataEnabled(preSubId, false);+ }+ } /// M: for plug-in, need to call after setDefaultDataSubId mSimManagementExt.setDataStateEnable(subId); /// M: for plug-in @{
十:CARD 改为 SIM
(frameworks/base/packages/Keyguard/src/com/mediatek/keyguard/Telephony/KeyguardSimPinPukMeView.java)
/// fetch the latest/updated active sub list. SubscriptionInfo info = mUpdateMonitor.getSubscriptionInfoForSubId(subId, forceReload); CharSequence displayName = info != null ? info.getDisplayName() : ""; // don't crash+ displayName = ((String) displayName).replace("CARD 1","SIM 1").replace("CARD 2","SIM 2"); // M: add for ALPS02475558 if (info == null) {- displayName = "CARD " + Integer.toString(mPhoneId + 1);+ displayName = "SIM " + Integer.toString(mPhoneId + 1); Log.d(TAG, "we set a displayname"); } Log.d(TAG, "resetState() - subId = " + subId + ", displayName = " + displayName);(packages/apps/Settings/src/com/android/settings/sim/SimDialogActivity.java)
mSimManagementExt.setCurrNetworkIcon(holder.icon, mDialogId, position); holder.icon.setAlpha(OPACITY); } else {- holder.title.setText(sir.getDisplayName());+ holder.title.setText((sir.getDisplayName().toString()).replace("CARD", "SIM")); holder.summary.setText(sir.getNumber()); holder.icon.setImageBitmap(sir.createIconBitmap(mContext)); /// M: when item numbers is over the screen, should set alpha 1.0f.
十一:设置->设置PIN/密码锁成功后,再进入输入密码界面,无须输入密码直接点击确定,提示“设置已停止运行”
(packages/apps/Settings/src/com/android/settings/ConfirmLockPassword.java)
mPasswordEntryInputDisabler.setInputEnabled(false); - final String pin = mPasswordEntry.getText().toString();+ String pin = mPasswordEntry.getText().toString();+ if (pin.equals("")){+ pin = "0" ;+ } final boolean verifyChallenge = getActivity().getIntent().getBooleanExtra( ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false); Intent intent = new Intent();
十二:删除phone > 通话 > IP前缀... 这个选项
(packages/services/Telephony/src/com/android/phone/CallFeaturesSetting.java)
} private void setIpFunction() {+ PreferenceScreen press = getPreferenceScreen(); Preference prefIp = getPreferenceScreen().findPreference(IP_PREFIX_KEY); Intent intent = new Intent(this, IpPrefixPreference.class); intent.putExtra(SubscriptionInfoHelper.SUB_ID_EXTRA, mSubscriptionInfoHelper.getSubId()); if (prefIp != null) { prefIp.setIntent(intent); }+ press.removePreference(prefIp); } private BroadcastReceiver mReceiver = new BroadcastReceiver() {
十三:浏览器默认搜索引擎更改
(vendor/mediatek/proprietary/packages/apps/Browser/src/com/android/browser/preferences/SearchEngineSettings.java)
mEntries[i] = searchEngines.get(i).getLabel(); mEntryFavicon[i] = searchEngines.get(i).getFaviconUri(); if (mEntryValues[i].equals(searchEngineName)) {- selectedItem = i;+ selectedItem = 1; } }
十四:更改fingerprint认证
(build/tools/buildinfo.sh)
echo "# Do not try to parse description, fingerprint, or thumbprint" echo "ro.build.description=$PRIVATE_BUILD_DESC"-echo "ro.build.fingerprint=$VANZO_INNER_CUSTOM_PRODUCT_BRAND/$VANZO_INNER_CUSTOM_PRODUCT_NAME/$VANZO_INNER_CUSTOM_PRODUCT_DEVICE:$PLATFORM_VERSION/$BUILD_ID/`date +%Y%m%d.%H%M%S`:$TARGET_BUILD_TYPE/release-keys"-echo "ro.bootimage.build.fingerprint=$VANZO_INNER_CUSTOM_PRODUCT_BRAND/$VANZO_INNER_CUSTOM_PRODUCT_NAME/$VANZO_INNER_CUSTOM_PRODUCT_DEVICE:$PLATFORM_VERSION/$BUILD_ID/`date +%Y%m%d.%H%M%S`:$TARGET_BUILD_TYPE/release-keys"+echo "ro.build.fingerprint=Azumi/Speed_Pro_55/Speed_Pro_55:7.0/NRD90M/20170401.113705:user/release-keys"+echo "ro.bootimage.build.fingerprint=Azumi/Speed_Pro_55/Speed_Pro_55:7.0/NRD90M/20170401.113705:user/release-keys" if [ -n "$BUILD_THUMBPRINT" ] ; then echo "ro.build.thumbprint=$BUILD_THUMBPRINT" fi
十五:文件管理中更改存储空间大小
(vendor/mediatek/proprietary/packages/apps/FileManager/src/com/mediatek/filemanager/FileInfoAdapter.java)
LogUtils.d(TAG, "setSizeText, freeSpace = " + MountPointManager.getInstance().getMountPointFreeSpace(fileInfo.getFileAbsolutePath()) + ",totalSpace = " + MountPointManager.getInstance().getMountPointTotalSpace(fileInfo.getFileAbsolutePath())); - sb.append(mResources.getString(R.string.free_space)).append(" ");- sb.append(freeSpaceString).append(" \n");- sb.append(mResources.getString(R.string.total_space)).append(" ");- sb.append(totalSpaces).append(" ");+ sb.append(mResources.getString(R.string.free_space)).append(" ");+ sb.append(freeSpaceString).append(", ");+ String path = fileInfo.getFileAbsolutePath();+ if (MountPointManager.getInstance().isInternalMountPath(path)) {+ String totalSpacesCustom = "16.0GB";+ sb.append(mResources.getString(R.string.total_space)).append(" ");+ sb.append(totalSpacesCustom).append(" ");+ } else {+ sb.append(mResources.getString(R.string.total_space)).append(" ");+ sb.append(totalSpaces).append(" ");+ } textView.setText(sb.toString()); textView.setVisibility(View.VISIBLE); } else {
十六:设置 > 存储 加入总空间/可用空间/系统空间
(packages/apps/Settings/)
(res/values-es/strings_storage.xml)
+<?xml version="1.0" encoding="UTF-8"?>+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">+ <string name="storage_detail_total">Memoria Total</string>+ <string name="storage_detail_available">Memoria Disponible</string>+ <string name="storage_detail_system">Memoria del Sistema</string>+</resources>
(res/values-zh-rCN/strings_storage.xml)
+<?xml version="1.0" encoding="UTF-8"?>+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">+ <string name="storage_detail_total">总空间</string>+ <string name="storage_detail_available">可用</string>+ <string name="storage_detail_system">系统</string>+</resources>
(res/values/strings_storage.xml)
+<?xml version="1.0" encoding="UTF-8"?>+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">+ <string name="storage_detail_total">Total Space</string>+ <string name="storage_detail_available">Available</string>+ <string name="storage_detail_system">System</string>+</resources>
(src/com/android/settings/deviceinfo/PrivateVolumeSettings.java)
private static final String AUTHORITY_MEDIA = "com.android.providers.media.documents"; private static final int[] ITEMS_NO_SHOW_SHARED = new int[] {+ R.string.storage_detail_total,+ R.string.storage_detail_available,+ R.string.storage_detail_system, R.string.storage_detail_apps, }; private static final int[] ITEMS_SHOW_SHARED = new int[] {+ R.string.storage_detail_total,+ R.string.storage_detail_available,+ R.string.storage_detail_system, R.string.storage_detail_apps, R.string.storage_detail_images, R.string.storage_detail_videos,@@ -241,12 +247,24 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { final long freeBytes = file.getFreeSpace(); final long usedBytes = totalBytes - freeBytes; - final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);- mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),- result.value, result.units));- mSummary.setSummary(getString(R.string.storage_volume_used,- Formatter.formatFileSize(context, totalBytes)));- mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));+ if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {+ final long systemBytes = (long) ((16.0 * 1024 * 1024 * 1024) - totalBytes);+ final BytesResult systemresult = Formatter.formatBytes(getResources(), systemBytes, 0);+ final BytesResult result = Formatter.formatBytes(getResources(), systemBytes+usedBytes, 0);+ mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),+ result.value, result.units));+ mSummary.setSummary(getString(R.string.storage_volume_used,+ Formatter.formatFileSize(context, (long) (16.0 * 1024 * 1024 * 1024))));+ mSummary.setPercent((int) (((systemBytes+usedBytes) * 100) / (float) (16.0 * 1024 * 1024 * 1024)));++ }else{+ final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);+ mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),+ result.value, result.units));+ mSummary.setSummary(getString(R.string.storage_volume_used,+ Formatter.formatFileSize(context, totalBytes)));+ mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));+ } mExt.updateCustomizedPrivateSettingsPlugin(screen, mVolume); mMeasure.forceMeasure(); mNeedsUpdate = false;@@ -276,6 +294,13 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { private void addDetailItems(PreferenceGroup category, boolean showShared, int userId) { final int[] itemsToAdd = (showShared ? ITEMS_SHOW_SHARED : ITEMS_NO_SHOW_SHARED); for (int i = 0; i < itemsToAdd.length; ++i) {+ if (!VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {+ if (itemsToAdd[i] == R.string.storage_detail_total+ || itemsToAdd[i] == R.string.storage_detail_available+ || itemsToAdd[i] == R.string.storage_detail_system) {+ continue;+ }+ } addItem(category, itemsToAdd[i], null, userId); } }@@ -295,7 +320,20 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { item.setTitle(titleRes); item.setKey(Integer.toString(titleRes)); }- item.setSummary(R.string.memory_calculating_size);+ final Context context = getActivity();+ final File file = mVolume.getPath();+ final long totalBytes = file.getTotalSpace();+ final long freeBytes = file.getFreeSpace();+ final long usedBytes = totalBytes - freeBytes;+ if (titleRes == R.string.storage_detail_total) {+ item.setSummary("16.00 GB");+ } else if (titleRes == R.string.storage_detail_available){+ item.setSummary(Formatter.formatFileSize(context, freeBytes));+ } else if (titleRes == R.string.storage_detail_system) {+ item.setSummary(Formatter.formatFileSize(context, (long)(16.0 * 1024 * 1024 * 1024) - totalBytes));+ } else {+ item.setSummary(R.string.memory_calculating_size);+ } item.userHandle = userId; addPreference(group, item); ++mItemPoolIndex;
(src/com/android/settings/deviceinfo/PublicVolumeSettings.java)
final long freeBytes = file.getFreeSpace(); final long usedBytes = totalBytes - freeBytes; - final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);- mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),- result.value, result.units));- mSummary.setSummary(getString(R.string.storage_volume_used,- Formatter.formatFileSize(context, totalBytes)));- mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));+ if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {+ final long systemBytes = (long) ((16.0 * 1024 * 1024 * 1024) - totalBytes);+ final BytesResult result = Formatter.formatBytes(getResources(), systemBytes+usedBytes, 0);+ mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),+ result.value, result.units));+ mSummary.setSummary(getString(R.string.storage_volume_used,+ Formatter.formatFileSize(context, (long) (16.0 * 1024 * 1024 * 1024)))+"---");+ mSummary.setPercent((int) (((usedBytes+systemBytes) * 100) / (float)(16.0 * 1024 * 1024 * 1024)));+ }else{+ final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);+ mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),+ result.value, result.units));+ mSummary.setSummary(getString(R.string.storage_volume_used,+ Formatter.formatFileSize(context, totalBytes)));+ mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));+ } } if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {(src/com/android/settings/deviceinfo/StorageSettings.java)
int privateCount = 0; long privateUsedBytes = 0; long privateTotalBytes = 0;+ long systemBytes = 0; final List<VolumeInfo> volumes = mStorageManager.getVolumes(); Collections.sort(volumes, VolumeInfo.getDescriptionComparator());@@ -190,6 +191,9 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index final File path = vol.getPath(); privateUsedBytes += path.getTotalSpace() - path.getFreeSpace(); privateTotalBytes += path.getTotalSpace();+ if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())){+ systemBytes = (long) ((16.0 * 1024 * 1024 * 1024) - path.getTotalSpace());+ } } } else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) { mExternalCategory.addPreference(@@ -229,11 +233,11 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index } } - final BytesResult result = Formatter.formatBytes(getResources(), privateUsedBytes, 0);- mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),- result.value, result.units));- mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,- Formatter.formatFileSize(context, privateTotalBytes)));+ final BytesResult result = Formatter.formatBytes(getResources(),systemBytes+privateUsedBytes, 0);+ mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),+ result.value, result.units));+ mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,+ Formatter.formatFileSize(context, privateTotalBytes+systemBytes))); mExt.updateCustomizedStorageSettingsPlugin(mInternalCategory); if (mInternalCategory.getPreferenceCount() > 0) { getPreferenceScreen().addPreference(mInternalCategory);@@ -514,6 +516,8 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index final List<VolumeInfo> volumes = storageManager.getVolumes(); long privateUsedBytes = 0; long privateTotalBytes = 0;+ long systemBytes = 0;+ for (VolumeInfo info : volumes) { if (info.getType() != VolumeInfo.TYPE_PUBLIC && info.getType() != VolumeInfo.TYPE_PRIVATE) {@@ -528,7 +532,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index if (path == null) { continue; }+ if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(info.getId())){+ systemBytes = (long) ((16.0 * 1024 * 1024 * 1024) - path.getTotalSpace());+ } privateUsedBytes += path.getTotalSpace() - path.getFreeSpace(); privateTotalBytes += path.getTotalSpace(); } mLoader.setSummary(this, mContext.getString(R.string.storage_summary,- Formatter.formatFileSize(mContext, privateUsedBytes),- Formatter.formatFileSize(mContext, privateTotalBytes)));+ Formatter.formatFileSize(mContext, systemBytes+privateUsedBytes),+ Formatter.formatFileSize(mContext, systemBytes+privateTotalBytes))); } }
(src/com/android/settings/deviceinfo/StorageVolumePreference.java)
final long freeBytes = path.getFreeSpace(); final long totalBytes = path.getTotalSpace(); final long usedBytes = totalBytes - freeBytes;+ final long systemBytes = (long) ((16.0 * 1024 * 1024 * 1024) - totalBytes); final String used = Formatter.formatFileSize(context, usedBytes);+ final String usedSystem = Formatter.formatFileSize(context, usedBytes+systemBytes); final String total = Formatter.formatFileSize(context, totalBytes); setSummary(context.getString(R.string.storage_volume_summary, used, total)); if (totalBytes > 0) { mUsedPercent = (int) ((usedBytes * 100) / totalBytes); } + if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.getId())) {+ setSummary(context.getString(R.string.storage_volume_summary, usedSystem, "16.0 GB"));+ if (totalBytes != 0) {+ mUsedPercent = (int) (((usedBytes+systemBytes) * 100) / (float) (16.0 * 1024 * 1024 * 1024));+ }+ } else {+ setSummary(context.getString(R.string.storage_volume_summary, used, total));+ if (totalBytes != 0) {+ mUsedPercent = (int) ((usedBytes * 100) / totalBytes);+ }+ }+ if (freeBytes < mStorageManager.getStorageLowBytes(path)) { mColor = StorageSettings.COLOR_WARNING; icon = context.getDrawable(R.drawable.ic_warning_24dp);
十七:设置 > 存储 顶部加入显示 ROM/RAM
(packages/apps/Settings/)
(res/values/strings.xml)
+ <string name="storage_detail_title">ROM INFORMATION</string>+ <string name="storage_detail_total">"Total ROM"</string>+ <string name="storage_detail_system">Total RAM</string>(src/com/android/settings/deviceinfo/PrivateVolumeSettings.java)
import android.content.Context; import android.content.DialogInterface; import android.content.Intent;+import java.text.DecimalFormat; import android.content.pm.IPackageDataObserver; import android.content.pm.PackageInfo; import android.content.pm.PackageManager;@@ -121,6 +122,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { private int mItemPoolIndex; private Preference mExplore;+ private Preference storage_detail_system;+ private Preference storage_detail_total; private boolean mNeedsUpdate; @@ -168,6 +171,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { mCurrentUser = mUserManager.getUserInfo(UserHandle.myUserId()); mExplore = buildAction(R.string.storage_menu_explore);+ storage_detail_system = buildAction(R.string.storage_detail_system);+ storage_detail_total = buildAction(R.string.storage_detail_total); mNeedsUpdate = true; @@ -195,8 +200,9 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { final PreferenceScreen screen = getPreferenceScreen(); screen.removeAll(); addPreference(screen, mSummary); List<UserInfo> allUsers = mUserManager.getUsers(); final int userCount = allUsers.size();@@ -233,6 +239,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { addItem(screen, R.string.storage_detail_cached, null, UserHandle.USER_NULL); if (showShared) {+ addCategory2(screen); addPreference(screen, mExplore); } @@ -241,12 +248,29 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { final long freeBytes = file.getFreeSpace(); final long usedBytes = totalBytes - freeBytes; - final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);- mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),- result.value, result.units));- mSummary.setSummary(getString(R.string.storage_volume_used,- Formatter.formatFileSize(context, totalBytes)));- mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));+ if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) { + final long systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - totalBytes);+ final BytesResult systemresult = Formatter.formatBytes(getResources(), systemBytes, 0);+ storage_detail_system.setSummary("1.0 GB");+ storage_detail_total.setSummary("8.0 GB");++ final BytesResult result = Formatter.formatBytes(getResources(), systemBytes+usedBytes, 0);+ mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),+ result.value, result.units));+ mSummary.setSummary(getString(R.string.storage_volume_used,+ Formatter.formatFileSize(context, (long) (8.0 * 1024 * 1024 * 1024))));+ mSummary.setPercent((int) (((systemBytes+usedBytes) * 100) / (float) (8.0 * 1024 * 1024 * 1024)));++ }else{+ storage_detail_system.setSummary("1.0 GB");+ storage_detail_total.setSummary("8.0 GB");+ final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);+ mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),+ result.value, result.units));+ mSummary.setSummary(getString(R.string.storage_volume_used,+ Formatter.formatFileSize(context, totalBytes)));+ mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));+ }+ mExt.updateCustomizedPrivateSettingsPlugin(screen, mVolume); mMeasure.forceMeasure(); mNeedsUpdate = false;@@ -273,6 +297,29 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { return category; } + private PreferenceCategory addCategory2(PreferenceGroup group) {+ PreferenceCategory category;+ if (mHeaderPoolIndex < mHeaderPreferencePool.size()) {+ category = mHeaderPreferencePool.get(mHeaderPoolIndex);+ } else {+ category = new PreferenceCategory(getPrefContext(), null,+ com.android.internal.R.attr.preferenceCategoryStyle);+ mHeaderPreferencePool.add(category);+ }+ category.setTitle(R.string.storage_detail_title);+ category.removeAll();+ addPreference2(group, category,-1);+ addPreference(category, storage_detail_total);+ addPreference(category, storage_detail_system);+ ++mHeaderPoolIndex;+ return category;+ }++ private void addPreference2(PreferenceGroup group, Preference pref,int order) {+ pref.setOrder(order);+ group.addPreference(pref);+ }+ private void addDetailItems(PreferenceGroup category, boolean showShared, int userId) { final int[] itemsToAdd = (showShared ? ITEMS_SHOW_SHARED : ITEMS_NO_SHOW_SHARED); for (int i = 0; i < itemsToAdd.length; ++i) {
(src/com/android/settings/deviceinfo/PublicVolumeSettings.java)final long freeBytes = file.getFreeSpace(); final long usedBytes = totalBytes - freeBytes; - final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);- mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),- result.value, result.units));- mSummary.setSummary(getString(R.string.storage_volume_used,- Formatter.formatFileSize(context, totalBytes)));- mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));+ if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) { + final long systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - totalBytes); + final BytesResult result = Formatter.formatBytes(getResources(), systemBytes+usedBytes, 0); + mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large), + result.value, result.units)); + mSummary.setSummary(getString(R.string.storage_volume_used, + Formatter.formatFileSize(context, (long) (8.0 * 1024 * 1024 * 1024)))+"---"); + mSummary.setPercent((int) (((usedBytes+systemBytes) * 100) / (float)(8.0 * 1024 * 1024 * 1024))); + }else{ + final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0); + mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large), + result.value, result.units)); + mSummary.setSummary(getString(R.string.storage_volume_used, + Formatter.formatFileSize(context, totalBytes))); + mSummary.setPercent((int) ((usedBytes * 100) / totalBytes)); + } } if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {(src/com/android/settings/deviceinfo/StorageSettings.java)int privateCount = 0; long privateUsedBytes = 0; long privateTotalBytes = 0;+ long systemBytes = 0; final List<VolumeInfo> volumes = mStorageManager.getVolumes(); Collections.sort(volumes, VolumeInfo.getDescriptionComparator());@@ -190,6 +191,9 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index final File path = vol.getPath(); privateUsedBytes += path.getTotalSpace() - path.getFreeSpace(); privateTotalBytes += path.getTotalSpace();+ if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())){ + systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - path.getTotalSpace()); + } } } else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) { mExternalCategory.addPreference(@@ -229,11 +233,14 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index } } - final BytesResult result = Formatter.formatBytes(getResources(), privateUsedBytes, 0);- mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),- result.value, result.units));- mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,- Formatter.formatFileSize(context, privateTotalBytes)));+ final BytesResult result = Formatter.formatBytes(getResources(),systemBytes+privateUsedBytes, 0);+ mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),+ result.value, result.units)); + mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,+ Formatter.formatFileSize(context, privateTotalBytes+systemBytes))); mExt.updateCustomizedStorageSettingsPlugin(mInternalCategory); if (mInternalCategory.getPreferenceCount() > 0) { getPreferenceScreen().addPreference(mInternalCategory);
(src/com/android/settings/deviceinfo/StorageVolumePreference.java)final long freeBytes = path.getFreeSpace(); final long totalBytes = path.getTotalSpace(); final long usedBytes = totalBytes - freeBytes;+ final long systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - totalBytes); final String used = Formatter.formatFileSize(context, usedBytes);+ final String usedSystem = Formatter.formatFileSize(context, usedBytes+systemBytes); final String total = Formatter.formatFileSize(context, totalBytes); setSummary(context.getString(R.string.storage_volume_summary, used, total));+ /*setSummary(context.getString(R.string.storage_volume_summary, used, total)); if (totalBytes > 0) { mUsedPercent = (int) ((usedBytes * 100) / totalBytes);+ }*/+ if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.getId())) { + setSummary(context.getString(R.string.storage_volume_summary, usedSystem, "8.0 GB")); + if (totalBytes != 0) { + mUsedPercent = (int) (((usedBytes+systemBytes) * 100) / (float) (8.0 * 1024 * 1024 * 1024)); + } + } else { + setSummary(context.getString(R.string.storage_volume_summary, used, total)); + if (totalBytes != 0) { + mUsedPercent = (int) ((usedBytes * 100) / totalBytes); + } } if (freeBytes < mStorageManager.getStorageLowBytes(path)) { mColor = StorageSettings.COLOR_WARNING; icon = context.getDrawable(R.drawable.ic_warning_24dp);十八:sim卡应用里删除 toast
(mediatek/proprietary/packages/apps/Stk/src/com/android/stk/StkAppService.java)
if (mStkContext[slotId].mMainCmd == null) { CatLog.w(LOG_TAG, "mMainCmd is null"); // nothing todo when no SET UP MENU command didn't arrive.+/* Vanzo:tanglei on: Tue, 18 Apr 2017 15:43:39 +0800 mToast = Toast.makeText(mContext.getApplicationContext(), R.string.main_menu_not_initialized, Toast.LENGTH_LONG); mToast.setGravity(Gravity.BOTTOM, 0, 0); mToast.show();+ */+// End of Vanzo:tanglei StkAppService.mIsLauncherAcceptInput = true; // //Workaround for the toast is not canceled sometimes. // Message msg1 = mServiceHandler.obtainMessage(OP_CANCEL_TOAST_MSG);@@ -915,10 +918,13 @@ public class StkAppService extends Service implements Runnable { */ if (mStkContext[slotId].mAvailable != STK_AVAIL_AVAILABLE) {+/* Vanzo:tanglei on: Tue, 18 Apr 2017 15:43:50 +0800 mToast = Toast.makeText(mContext.getApplicationContext(), R.string.lable_not_available, Toast.LENGTH_LONG); mToast.setGravity(Gravity.BOTTOM, 0, 0); mToast.show();+ */+// End of Vanzo:tanglei StkAppService.mIsLauncherAcceptInput = true; // //Workaround for the toast is not canceled sometimes. // Message msg1 = mServiceHandler.obtainMessage(OP_CANCEL_TOAST_MSG);@@ -3386,6 +3392,7 @@ public class StkAppService extends Service implements Runnable { } } +/* Vanzo:tanglei on: Tue, 18 Apr 2017 15:43:13 +0800 mToast = toast; mToast.setView(v); mToast.setDuration(Toast.LENGTH_LONG);@@ -3396,6 +3403,8 @@ public class StkAppService extends Service implements Runnable { msg1.arg1 = OP_CANCEL_TOAST_MSG; msg1.arg2 = slotId; mServiceHandler.sendMessageDelayed(msg1, DELAY_TO_CANCEL_TOAST_TIMEOUT);+ */+// End of Vanzo:tanglei } private void launchEventMessage(int slotId) {十九:语音邮件通知无法移除
(frameworks/base/telephony/java/android/telephony/CarrierConfigManager.java)
sDefaults.putBoolean(KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL, true); sDefaults.putBoolean(KEY_USE_HFA_FOR_PROVISIONING_BOOL, false); sDefaults.putBoolean(KEY_USE_OTASP_FOR_PROVISIONING_BOOL, false);- sDefaults.putBoolean(KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL, false);+ sDefaults.putBoolean(KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL, true); sDefaults.putBoolean(KEY_VOICE_PRIVACY_DISABLE_UI_BOOL, false); sDefaults.putBoolean(KEY_WORLD_PHONE_BOOL, false); sDefaults.putInt(KEY_VOLTE_REPLACEMENT_RAT_INT, 0);二十:壁纸做过不滑动后(宽X2),锁屏解锁时会闪半张壁纸
(frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java)
} boolean allowWhenShade = false; if (ENABLE_LOCKSCREEN_WALLPAPER && artworkDrawable == null) {- Bitmap lockWallpaper = mLockscreenWallpaper.getBitmap();+ Bitmap lockWallpaper;+ Bitmap PreLockWallpaper = mLockscreenWallpaper.getBitmap();+ if(PreLockWallpaper != null) {+ int width = PreLockWallpaper.getWidth();+ int height = PreLockWallpaper.getHeight();+ if (width > height) {+ lockWallpaper = Bitmap.createBitmap(PreLockWallpaper,width/4,0,width/2,height);+ } else {+ lockWallpaper = PreLockWallpaper;+ }+ } else {+ lockWallpaper = PreLockWallpaper;+ } if (lockWallpaper != null) { artworkDrawable = new LockscreenWallpaper.WallpaperDrawable( mBackdropBack.getResources(), lockWallpaper);
二十一:删除投射功能(下拉状态栏及设置里的)(frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java)
else if (tileSpec.equals("rotation")) return new RotationLockTile(this); else if (tileSpec.equals("flashlight")) return new FlashlightTile(this); else if (tileSpec.equals("location")) return new LocationTile(this);- else if (tileSpec.equals("cast")) return new CastTile(this);+ else if (tileSpec.equals("cast")) return null; else if (tileSpec.equals("hotspot")) return new HotspotTile(this); /* Vanzo:houcongxi on: Tue, 24 May 2016 18:18:29 +0800 * add superscreenshot
(packages/apps/Settings/res/xml/sound_settings.xml)android:fragment="com.android.settings.notification.OtherSoundSettings" /> <!-- Cast -->- <PreferenceScreen+ <!--<PreferenceScreen android:key="wifi_display" android:title="@string/wifi_display_settings_title"- android:fragment="com.android.settings.wfd.WifiDisplaySettings" />+ android:fragment="com.android.settings.wfd.WifiDisplaySettings" />--> <!-- M: Sound Enhancement --> <PreferenceScreen二十二:拍照人脸美化会生成两张照片
(vendor/mediatek/proprietary/packages/apps/Camera/src/com/mediatek/camera/mode/facebeauty/FaceBeautyMode.java)
if (!mIFeatureConfig.isVfbEnable()) { mIFileSaver.init(FILE_TYPE.JPEG, 0, null, -1); long time = System.currentTimeMillis();- mIFileSaver.savePhotoFile(data, null, time, mIModuleCtrl.getLocation(), 0,- mFileSavedListener);+ // mIFileSaver.savePhotoFile(data, null, time, mIModuleCtrl.getLocation(), 0,+ // mFileSavedListener); } } }二十三:做CE认证必须要有自动接听功能,现在我们的进入工程模式没有自动接听功能,请安排增加上
(vendor/mediatek/proprietary/packages/apps/EngineerMode/src/com/mediatek/engineermode/PrefsFragment.java)if ( !( isTestSim() || FeatureSupport.isEngLoad() || FeatureSupport.isUserDebugLoad() || ChipSupport.isFeatureSupported(ChipSupport.MTK_USERLOAD_SUPPORT) ) ) {- removePreference(screen, "auto_answer"); Log.d("@M_" + TAG, "it is not an test sim card!"); }else{ Log.d("@M_" + TAG, "it is an test sim card or debug load");@@ -299,7 +298,6 @@ public class PrefsFragment extends PreferenceFragment { } if (FeatureSupport.isSupported(FeatureSupport.FK_BSP_PACKAGE)) {- removePreference(screen, "auto_answer"); } if (ChipSupport.isFeatureSupported(ChipSupport.MTK_FM_SUPPORT)) {@@ -344,7 +342,6 @@ public class PrefsFragment extends PreferenceFragment { } if (!isVoiceCapable() || isWifiOnly()) {- removePreference(screen, "auto_answer"); removePreference(screen, "repeat_call_test"); }二十四:在现在在没有插入耳机的情况也能进入FM测试项进行,且进入FM测试项没有出现提示:请插入耳机
(vendor/mediatek/proprietary/packages/apps/FMRadio/src/com/android/fmradio/TestFM.java)
import android.view.View; import android.view.View.OnClickListener; import android.widget.Button;-+import android.widget.Toast; import com.android.fmradio.FmService.ServiceBinder; import java.io.IOException;@@ -49,6 +49,8 @@ public class TestFM extends Activity implements OnClickListener { private boolean mIsSearch = false; + private AudioManager audoManager; + private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) {@@ -66,6 +68,13 @@ public class TestFM extends Activity implements OnClickListener { mSuccess = (Button) findViewById(R.id.success); mFail = (Button) findViewById(R.id.fail); mSearch = (Button) findViewById(R.id.search);+ audoManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);+ boolean isHeadsetOn = audoManager.isWiredHeadsetOn();+ if (!isHeadsetOn){+ Toast.makeText(this,+ R.string.fm_no_headset_text,+ Toast.LENGTH_SHORT).show();+ } mSuccess.setOnClickListener(this); mSuccess.setEnabled(false); mFail.setOnClickListener(this);@@ -73,7 +82,9 @@ public class TestFM extends Activity implements OnClickListener { @Override public void onClick(View v) { if (!mIsSearch) {+ if(isHeadsetOn){ mSuccess.setEnabled(true);+ } mIsSearch = true; new Thread() { public void run() {
- Android7.0 MTK 需求文档(一)
- Android7.0 MTK 需求文档(二)
- Android6.0 MTK 需求文档(一)
- Android6.0 MTK 需求文档(二)
- Android6.0 MTK 需求文档(三)
- Android6.0 MTK 需求文档(四)
- Android6.0 MTK 需求文档(五)
- Android6.0 MTK 需求文档(六)
- Android6.0 MTK 需求文档(七)
- Android7.0中文文档(API)--- FrameLayout
- Android7.0中文文档(API)--- DatePicker
- Android7.0中文文档(API) --- MediaController
- Android7.0中文文档(API)--- TabHost
- Android7.0中文文档(API) -- TimePicker
- Android7.0中文文档(API)-- ViewAnimator
- Android7.0中文文档(API)--- AbsoluteLayout
- Android7.0中文文档(API) -- Switch
- Android7.0中文文档(API) --- ToggleButton
- NLP计算文档相似度之LSH
- Linux CentOS上安装配置java
- easyUI的data-options修改
- Codeforces 808A Lucky Year 题解
- Web.xml配置详解之context-param
- Android7.0 MTK 需求文档(一)
- String、StringBuffer与StringBuilder之间区别
- 利用padding margin 布局
- ZooKeeper注册中心安装详细步骤(单节点)
- Java应用CPU占用100%原因分析
- Bootstrap-select多选下拉框实现
- 【设计模式】之观察者模式
- String、StringBuffer、StringBuilder三者区别
- json字符串转为list<T>类型