diff options
author | Steve Kondik <steve@cyngn.com> | 2015-11-04 10:43:28 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-11-04 10:58:59 -0800 |
commit | 8331d3e508498a19c296fed41b9d4b23ea960031 (patch) | |
tree | ab450acfb4e38ffdba3ae893a83a052cc0041783 | |
parent | b956432599de00a5edfeccc56615cb03c229c4e9 (diff) | |
parent | 64a04eb003d2af5bbc84db3062ee4d6a4194c513 (diff) | |
download | frameworks_base-8331d3e508498a19c296fed41b9d4b23ea960031.zip frameworks_base-8331d3e508498a19c296fed41b9d4b23ea960031.tar.gz frameworks_base-8331d3e508498a19c296fed41b9d4b23ea960031.tar.bz2 |
Merge branch 'LA.BF64.1.2.2_rb4.6' of git://codeaurora.org/platform/frameworks/base into cm-13.0
Change-Id: I261957864b149edb709e6f76ed382043f9a96936
25 files changed, 254 insertions, 164 deletions
diff --git a/cmds/idmap/inspect.cpp b/cmds/idmap/inspect.cpp index a7844a9..3087e6e 100644 --- a/cmds/idmap/inspect.cpp +++ b/cmds/idmap/inspect.cpp @@ -235,7 +235,8 @@ namespace { } status_t parse_data(IdmapBuffer& buf, const AssetManager& am) { - const uint32_t packageId = am.getResources().getBasePackageId(0); + const ResTable& rt = am.getResources(); + const uint32_t packageId = rt.getBasePackageId(rt.getBasePackageCount() - 1); uint16_t data16; status_t err = buf.nextUint16(&data16); diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp index 34118e6..29b9cc3 100644 --- a/cmds/idmap/scan.cpp +++ b/cmds/idmap/scan.cpp @@ -165,6 +165,62 @@ namespace { delete dataMap; return priority; } + + int idmap_scan(const char *overlay_dir, const char *target_package_name, + const char *target_apk_path, const char *idmap_dir, + SortedVector<Overlay>& overlayVector) + { + DIR *dir = opendir(overlay_dir); + if (dir == NULL) { + return EXIT_FAILURE; + } + + struct dirent *dirent; + while ((dirent = readdir(dir)) != NULL) { + struct stat st; + char overlay_apk_path[PATH_MAX + 1]; + snprintf(overlay_apk_path, PATH_MAX, "%s/%s", overlay_dir, dirent->d_name); + if (stat(overlay_apk_path, &st) < 0) { + continue; + } + if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) { + continue; + } + + if (S_ISDIR(st.st_mode)) { + String8 dir_name = String8(overlay_apk_path).getPathLeaf(); + if (dir_name == "." || dir_name == "..") { + // Skip the "." and ".." dir. + continue; + } + idmap_scan(overlay_apk_path, target_package_name, target_apk_path, idmap_dir, + overlayVector); + } else { + int priority = parse_apk(overlay_apk_path, target_package_name); + if (priority < 0) { + continue; + } + + String8 idmap_path(idmap_dir); + idmap_path.appendPath(flatten_path(overlay_apk_path + 1)); + idmap_path.append("@idmap"); + + if (idmap_create_path(target_apk_path, overlay_apk_path, NULL, 0, 0, + idmap_path.string()) != 0) { + ALOGE("error: failed to create idmap for target=%s overlay=%s idmap=%s\n", + target_apk_path, overlay_apk_path, idmap_path.string()); + continue; + } + + Overlay overlay(String8(overlay_apk_path), idmap_path, priority); + overlayVector.add(overlay); + } + } + + closedir(dir); + + return EXIT_SUCCESS; + } } int idmap_scan(const char *overlay_dir, const char *target_package_name, @@ -176,49 +232,13 @@ int idmap_scan(const char *overlay_dir, const char *target_package_name, return EXIT_FAILURE; } - DIR *dir = opendir(overlay_dir); - if (dir == NULL) { - return EXIT_FAILURE; - } - SortedVector<Overlay> overlayVector; - struct dirent *dirent; - while ((dirent = readdir(dir)) != NULL) { - struct stat st; - char overlay_apk_path[PATH_MAX + 1]; - snprintf(overlay_apk_path, PATH_MAX, "%s/%s", overlay_dir, dirent->d_name); - if (stat(overlay_apk_path, &st) < 0) { - continue; - } - if (!S_ISREG(st.st_mode)) { - continue; - } - - int priority = parse_apk(overlay_apk_path, target_package_name); - if (priority < 0) { - continue; - } - - String8 idmap_path(idmap_dir); - idmap_path.appendPath(flatten_path(overlay_apk_path + 1)); - idmap_path.append("@idmap"); - - if (idmap_create_path(target_apk_path, overlay_apk_path, NULL, 0, 0, - idmap_path.string()) != 0) { - ALOGE("error: failed to create idmap for target=%s overlay=%s idmap=%s\n", - target_apk_path, overlay_apk_path, idmap_path.string()); - continue; - } - - Overlay overlay(String8(overlay_apk_path), idmap_path, priority); - overlayVector.add(overlay); - } - - closedir(dir); + int res = idmap_scan(overlay_dir, target_package_name, target_apk_path, idmap_dir, + overlayVector); - if (!writePackagesList(filename.string(), overlayVector)) { + if (res == EXIT_FAILURE || !writePackagesList(filename.string(), overlayVector)) { return EXIT_FAILURE; } - return EXIT_SUCCESS; + return res; } diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java index 3329025..abb1871 100644 --- a/core/java/android/content/res/AssetManager.java +++ b/core/java/android/content/res/AssetManager.java @@ -630,7 +630,9 @@ public final class AssetManager implements AutoCloseable { public final int addAssetPath(String path) { synchronized (this) { int res = addAssetPathNative(path); - makeStringBlocks(mStringBlocks); + if (mStringBlocks != null) { + makeStringBlocks(mStringBlocks); + } return res; } } @@ -650,7 +652,9 @@ public final class AssetManager implements AutoCloseable { synchronized (this) { int res = addOverlayPathNative(idmapPath, themeApkPath, resApkPath, targetPkgPath, prefixPath); - makeStringBlocks(mStringBlocks); + if (mStringBlocks != null) { + makeStringBlocks(mStringBlocks); + } return res; } } diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 0dd4b40..03ce768 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -513,6 +513,9 @@ <!-- Operating volatage for wifi radio. 0 by default--> <integer translatable="false" name="config_wifi_operating_voltage_mv">0</integer> + <!-- Wifi framework supports ECBM mode --> + <bool translatable="false" name="config_wifi_ecbm_mode_change">true</bool> + <!-- Flag indicating whether the we should enable the automatic brightness in Settings. Software implementation will be used if config_hardware_auto_brightness_available is not set --> <bool name="config_automatic_brightness_available">false</bool> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 1173069..834980f 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -293,6 +293,7 @@ <java-symbol type="bool" name="config_useFixedVolume" /> <java-symbol type="bool" name="config_forceDefaultOrientation" /> <java-symbol type="bool" name="config_wifi_batched_scan_supported" /> + <java-symbol type="bool" name="config_wifi_ecbm_mode_change" /> <java-symbol type="bool" name="config_enableMultiUserUI"/> <java-symbol type="bool" name="config_disableUsbPermissionDialogs"/> <java-symbol type="bool" name="config_hasRecents" /> diff --git a/include/androidfw/AssetManager.h b/include/androidfw/AssetManager.h index 13f7951..de10600 100644 --- a/include/androidfw/AssetManager.h +++ b/include/androidfw/AssetManager.h @@ -300,7 +300,7 @@ private: const ResTable* getResTable(bool required = true) const; void setLocaleLocked(const char* locale); void updateResourceParamsLocked() const; - bool appendPathToResTable(const asset_path& ap) const; + bool appendPathToResTable(const asset_path& ap, size_t* entryIdx) const; Asset* openIdmapLocked(const struct asset_path& ap) const; diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index 635aa5b..1add6c3 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -205,6 +205,11 @@ bool AssetManager::addAssetPath(const String8& path, int32_t* cookie) mAssetPaths.add(ap); + if (mResources != NULL) { + size_t index = mAssetPaths.size() - 1; + appendPathToResTable(ap, &index); + } + // new paths are always added at the end if (cookie) { *cookie = static_cast<int32_t>(mAssetPaths.size()); @@ -218,10 +223,6 @@ bool AssetManager::addAssetPath(const String8& path, int32_t* cookie) } #endif - if (mResources != NULL) { - appendPathToResTable(ap); - } - return true; } @@ -308,7 +309,8 @@ bool AssetManager::addOverlayPath(const String8& idmapPath, const String8& overl *cookie = static_cast<int32_t>(mAssetPaths.size()); if (mResources != NULL) { - appendPathToResTable(oap); + size_t index = mAssetPaths.size() - 1; + appendPathToResTable(oap, &index); } return true; @@ -349,7 +351,8 @@ bool AssetManager::addCommonOverlayPath(const String8& themePackagePath, int32_t *cookie = static_cast<int32_t>(mAssetPaths.size()); if (mResources != NULL) { - appendPathToResTable(oap); + size_t index = mAssetPaths.size() - 1; + appendPathToResTable(oap, &index); } return true; @@ -400,7 +403,8 @@ bool AssetManager::addIconPath(const String8& packagePath, int32_t* cookie, *cookie = static_cast<int32_t>(mAssetPaths.size()); if (mResources != NULL) { - appendPathToResTable(oap); + size_t index = mAssetPaths.size() - 1; + appendPathToResTable(oap, &index); } return true; @@ -795,7 +799,7 @@ FileType AssetManager::getFileType(const char* fileName) return kFileTypeRegular; } -bool AssetManager::appendPathToResTable(const asset_path& ap) const { +bool AssetManager::appendPathToResTable(const asset_path& ap, size_t* entryIdx) const { // skip those ap's that correspond to system overlays if (ap.isSystemOverlay) { return true; @@ -807,21 +811,20 @@ bool AssetManager::appendPathToResTable(const asset_path& ap) const { bool onlyEmptyResources = true; MY_TRACE_BEGIN(ap.path.string()); Asset* idmap = openIdmapLocked(ap); - size_t nextEntryIdx = mResources->getTableCount(); ALOGV("Looking for resource asset in '%s'\n", ap.path.string()); if (!ap.resApkPath.isEmpty()) { // Avoid using prefix path in this case since the compiled resApk will simply have resources.arsc in it ass = const_cast<AssetManager*>(this)->openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, ap, false); shared = false; } else if (ap.type != kFileTypeDirectory) { - if (nextEntryIdx == 0) { + if (*entryIdx == 0) { // The first item is typically the framework resources, // which we want to avoid parsing every time. sharedRes = const_cast<AssetManager*>(this)-> mZipSet.getZipResourceTable(ap.path); if (sharedRes != NULL) { // skip ahead the number of system overlay packages preloaded - nextEntryIdx = sharedRes->getTableCount(); + *entryIdx += sharedRes->getTableCount() - 1; } } if (sharedRes == NULL) { @@ -839,20 +842,20 @@ bool AssetManager::appendPathToResTable(const asset_path& ap) const { } } - if (nextEntryIdx == 0 && ass != NULL) { + if (*entryIdx == 0 && ass != NULL) { // If this is the first resource table in the asset // manager, then we are going to cache it so that we // can quickly copy it out for others. ALOGV("Creating shared resources for %s", ap.path.string()); sharedRes = new ResTable(); - sharedRes->add(ass, idmap, nextEntryIdx + 1, false, ap.pkgIdOverride); + sharedRes->add(ass, idmap, *entryIdx + 1, false, ap.pkgIdOverride); #ifdef HAVE_ANDROID_OS const char* data = getenv("ANDROID_DATA"); LOG_ALWAYS_FATAL_IF(data == NULL, "ANDROID_DATA not set"); String8 overlaysListPath(data); overlaysListPath.appendPath(kResourceCache); overlaysListPath.appendPath("overlays.list"); - addSystemOverlays(overlaysListPath.string(), ap.path, sharedRes, nextEntryIdx); + addSystemOverlays(overlaysListPath.string(), ap.path, sharedRes, *entryIdx); #endif sharedRes = const_cast<AssetManager*>(this)-> mZipSet.setZipResourceTable(ap.path, sharedRes); @@ -874,7 +877,7 @@ bool AssetManager::appendPathToResTable(const asset_path& ap) const { mResources->add(sharedRes); } else { ALOGV("Parsing resources for %s", ap.path.string()); - mResources->add(ass, idmap, nextEntryIdx + 1, !shared, ap.pkgIdOverride); + mResources->add(ass, idmap, *entryIdx + 1, !shared, ap.pkgIdOverride); } onlyEmptyResources = false; @@ -883,7 +886,7 @@ bool AssetManager::appendPathToResTable(const asset_path& ap) const { } } else { ALOGV("Installing empty resources in to table %p\n", mResources); - mResources->addEmpty(nextEntryIdx + 1); + mResources->addEmpty(*entryIdx + 1); } if (idmap != NULL) { @@ -923,7 +926,7 @@ const ResTable* AssetManager::getResTable(bool required) const bool onlyEmptyResources = true; const size_t N = mAssetPaths.size(); for (size_t i=0; i<N; i++) { - bool empty = appendPathToResTable(mAssetPaths.itemAt(i)); + bool empty = appendPathToResTable(mAssetPaths.itemAt(i), &i); onlyEmptyResources = onlyEmptyResources && empty; } diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index aa207e2..818e1c5 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -6533,8 +6533,10 @@ status_t ResTable::createIdmap(const ResTable& overlay, KeyedVector<uint8_t, IdmapTypeMap> map; - // overlaid packages are assumed to contain only one package group - const PackageGroup* pg = mPackageGroups[0]; + // Overlaid packages are assumed to contain only one package group or two package group + // as one is "system package(android)", and another is "application package". So we need + // to use the last package group to create idmap. + const PackageGroup* pg = mPackageGroups[mPackageGroups.size() - 1]; // starting size is header *outSize = ResTable::IDMAP_HEADER_SIZE_BYTES; diff --git a/packages/Keyguard/src/com/android/keyguard/CarrierText.java b/packages/Keyguard/src/com/android/keyguard/CarrierText.java index 416c7b0..f04db02 100644 --- a/packages/Keyguard/src/com/android/keyguard/CarrierText.java +++ b/packages/Keyguard/src/com/android/keyguard/CarrierText.java @@ -39,6 +39,7 @@ import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.IccCardConstants.State; import com.android.internal.telephony.TelephonyIntents; import com.android.settingslib.WirelessUtils; +import android.telephony.TelephonyManager; public class CarrierText extends TextView { private static final boolean DEBUG = KeyguardConstants.DEBUG; @@ -52,6 +53,8 @@ public class CarrierText extends TextView { private WifiManager mWifiManager; + private boolean[] mSimErrorState = new boolean[TelephonyManager.getDefault().getPhoneCount()]; + private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { @Override public void onRefreshCarrierInfo() { @@ -65,6 +68,22 @@ public class CarrierText extends TextView { public void onStartedWakingUp() { setSelected(true); }; + + public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { + if (slotId < 0) { + Log.d(TAG, "onSimStateChanged() - slotId invalid: " + slotId); + return; + } + + Log.d(TAG,"onSimStateChanged: " + getStatusForIccState(simState)); + if (getStatusForIccState(simState) == StatusMode.SimIoError) { + mSimErrorState[slotId] = true; + updateCarrierText(); + } else if (mSimErrorState[slotId]) { + mSimErrorState[slotId] = false; + updateCarrierText(); + } + }; }; /** * The status of this lock screen. Primarily used for widgets on LockScreen. @@ -102,6 +121,35 @@ public class CarrierText extends TextView { mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); } + /** + * Checks if there are faulty cards. Adds the text depending on the slot of the card + * @param text: current carrier text based on the sim state + * @param noSims: whether a valid sim card is inserted + * @return text + */ + private CharSequence updateCarrierTextWithSimIoError(CharSequence text, boolean noSims) { + final CharSequence carrier = ""; + CharSequence carrierTextForSimState = getCarrierTextForSimState( + IccCardConstants.State.CARD_IO_ERROR, carrier); + for (int index = 0; index < mSimErrorState.length; index++) { + if (mSimErrorState[index]) { + // In the case when no sim cards are detected but a faulty card is inserted + // overwrite the text and only show "Invalid card" + if (noSims) { + return concatenate(carrierTextForSimState, + getContext().getText(com.android.internal.R.string.emergency_calls_only)); + } else if (index == 0) { + // prepend "Invalid card" when faulty card is inserted in slot 0 + text = concatenate(carrierTextForSimState, text); + } else { + // concatenate "Invalid card" when faulty card is inserted in slot 1 + text = concatenate(text, carrierTextForSimState); + } + } + } + return text; + } + protected void updateCarrierText() { boolean allSimsMissing = true; boolean anySimReadyAndInService = false; @@ -180,6 +228,7 @@ public class CarrierText extends TextView { } } + displayText = updateCarrierTextWithSimIoError(displayText, allSimsMissing); // APM (airplane mode) != no carrier state. There are carrier services // (e.g. WFC = Wi-Fi calling) which may operate in APM. if (!anySimReadyAndInService && WirelessUtils.isAirplaneModeOn(mContext)) { diff --git a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java index cbf22c0..1411aaa 100644 --- a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java +++ b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java @@ -22,6 +22,7 @@ import android.content.Intent; import android.content.res.Configuration; import android.os.PowerManager; import android.os.SystemClock; +import android.os.SystemProperties; import android.os.UserHandle; import android.telecom.TelecomManager; import android.util.AttributeSet; @@ -135,7 +136,7 @@ public class EmergencyButton extends Button { } } - private void updateEmergencyCallButton() { + public void updateEmergencyCallButton() { boolean visible = false; if (mIsVoiceCapable) { // Emergency calling requires voice capability. @@ -149,7 +150,8 @@ public class EmergencyButton extends Button { visible = mEnableEmergencyCallWhileSimLocked; } else { // Only show if there is a secure screen (pin/pattern/SIM pin/SIM puk); - visible = mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser()); + visible = mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser()) || + SystemProperties.getBoolean("persist.radio.emgcy_btn_onswipe", false); } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 1a2fa97..a7648bf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -36,6 +36,7 @@ import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; +import android.os.SystemProperties; import android.os.UserHandle; import android.provider.MediaStore; import android.service.media.CameraPrewarmService; @@ -52,6 +53,7 @@ import android.widget.FrameLayout; import android.widget.TextView; import com.android.internal.widget.LockPatternUtils; +import com.android.keyguard.EmergencyButton; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.EventLogConstants; @@ -88,6 +90,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private static final int DOZE_ANIMATION_ELEMENT_DURATION = 250; private static final long TRANSIENT_FP_ERROR_TIMEOUT = 1300; + private EmergencyButton mEmergencyButton; private KeyguardAffordanceView mCameraImageView; private KeyguardAffordanceView mLeftAffordanceView; private LockIcon mLockIcon; @@ -188,6 +191,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL super.onFinishInflate(); mLockPatternUtils = new LockPatternUtils(mContext); mPreviewContainer = (ViewGroup) findViewById(R.id.preview_container); + mEmergencyButton = (EmergencyButton) findViewById(R.id.emergency_call_button); mCameraImageView = (KeyguardAffordanceView) findViewById(R.id.camera_button); mLeftAffordanceView = (KeyguardAffordanceView) findViewById(R.id.left_button); mLockIcon = (LockIcon) findViewById(R.id.lock_icon); @@ -197,6 +201,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mUnlockMethodCache = UnlockMethodCache.getInstance(getContext()); mUnlockMethodCache.addListener(this); mLockIcon.update(); + updateEmergencyButton(); setClipChildren(false); setClipToPadding(false); mPreviewInflater = new PreviewInflater(mContext, new LockPatternUtils(mContext)); @@ -229,6 +234,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mIndicationText.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize( com.android.internal.R.dimen.text_size_small_material)); + updateEmergencyButton(); } public void setActivityStarter(ActivityStarter activityStarter) { @@ -699,4 +705,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL updateLeftAffordanceIcon(); updateLeftPreview(); } + + private void updateEmergencyButton() { + if (SystemProperties.getBoolean("persist.radio.emgcy_btn_onswipe",false)) { + if (mEmergencyButton != null) { + mEmergencyButton.updateEmergencyCallButton(); + } + } + } } diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index 3988b3b..52a45f6 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -1494,7 +1494,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { mState = BluetoothAdapter.STATE_TURNING_ON; } - waitForOnOff(true, false); + waitForMonitoredOnOff(true, false); if (mState == BluetoothAdapter.STATE_TURNING_ON) { bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_ON); @@ -1507,7 +1507,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON, BluetoothAdapter.STATE_TURNING_OFF); - waitForOnOff(false, true); + waitForMonitoredOnOff(false, true); bluetoothStateChangeHandler(BluetoothAdapter.STATE_TURNING_OFF, BluetoothAdapter.STATE_OFF); @@ -1733,11 +1733,20 @@ class BluetoothManagerService extends IBluetoothManager.Stub { sendBleStateChanged(prevState, newState); } + if( newState == BluetoothAdapter.STATE_TURNING_ON + && prevState == BluetoothAdapter.STATE_BLE_ON) { + mEnable = true; + } + if (isStandardBroadcast) { if (prevState == BluetoothAdapter.STATE_BLE_ON) { // Show prevState of BLE_ON as OFF to standard users prevState = BluetoothAdapter.STATE_OFF; } + else if (prevState == BluetoothAdapter.STATE_BLE_TURNING_OFF) { + // show prevState to TURNING_OFF + prevState = BluetoothAdapter.STATE_TURNING_OFF; + } Intent intent = new Intent(BluetoothAdapter.ACTION_STATE_CHANGED); intent.putExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothAdapter.EXTRA_STATE, newState); @@ -1782,6 +1791,48 @@ class BluetoothManagerService extends IBluetoothManager.Stub { return false; } + /** + * if on is true, wait for state become ON + * if off is true, wait for state become OFF + * if both on and off are false, wait for state not ON + */ + private boolean waitForMonitoredOnOff(boolean on, boolean off) { + int i = 0; + while (i < 10) { + synchronized(mConnection) { + try { + if (mBluetooth == null) break; + if (on) { + if (mBluetooth.getState() == BluetoothAdapter.STATE_ON) return true; + if (mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { + bluetoothStateChangeHandler(BluetoothAdapter.STATE_BLE_TURNING_ON, + BluetoothAdapter.STATE_BLE_ON); + } + } else if (off) { + if (mBluetooth.getState() == BluetoothAdapter.STATE_OFF) return true; + if (mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { + bluetoothStateChangeHandler(BluetoothAdapter.STATE_TURNING_OFF, + BluetoothAdapter.STATE_BLE_ON); + } + } else { + if (mBluetooth.getState() != BluetoothAdapter.STATE_ON) return true; + } + } catch (RemoteException e) { + Log.e(TAG, "getState()", e); + break; + } + } + if (on || off) { + SystemClock.sleep(800); + } else { + SystemClock.sleep(50); + } + i++; + } + Log.e(TAG,"waitForOnOff time out"); + return false; + } + private void sendDisableMsg() { mHandler.sendMessage(mHandler.obtainMessage(MESSAGE_DISABLE)); } diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index c02eee2..f025955 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -455,7 +455,6 @@ public abstract class Connection extends Conferenceable { public void onConferenceStarted() {} public void onConferenceMergeFailed(Connection c) {} public void onExtrasChanged(Connection c, Bundle extras) {} - public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {} public void onCdmaConnectionTimeReset(Connection c) {} } @@ -1119,7 +1118,6 @@ public abstract class Connection extends Conferenceable { private Conference mConference; private ConnectionService mConnectionService; private Bundle mExtras; - private PhoneAccountHandle mPhoneAccountHandle = null; /** * Create a new Connection. @@ -1639,23 +1637,6 @@ public abstract class Connection extends Conferenceable { } /** - * @hide. - */ - public final void setPhoneAccountHandle(PhoneAccountHandle pHandle) { - mPhoneAccountHandle = pHandle; - for (Listener l : mListeners) { - l.onPhoneAccountChanged(this, pHandle); - } - } - - /** - * @hide. - */ - public final PhoneAccountHandle getPhoneAccountHandle() { - return mPhoneAccountHandle; - } - - /** * @hide */ public final void setConnectionService(ConnectionService connectionService) { diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java index 6863214..2e8f8fd 100644 --- a/telecomm/java/android/telecom/ConnectionRequest.java +++ b/telecomm/java/android/telecom/ConnectionRequest.java @@ -28,7 +28,7 @@ import android.os.Parcelable; public final class ConnectionRequest implements Parcelable { // TODO: Token to limit recursive invocations - private final PhoneAccountHandle mAccountHandle; + private PhoneAccountHandle mAccountHandle; private final Uri mAddress; private final Bundle mExtras; private final int mVideoState; @@ -74,6 +74,9 @@ public final class ConnectionRequest implements Parcelable { */ public PhoneAccountHandle getAccountHandle() { return mAccountHandle; } + /** {@hide} */ + public void setAccountHandle(PhoneAccountHandle acc) { mAccountHandle = acc; } + /** * The handle (e.g., phone number) to which the {@link Connection} is to connect. */ diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 306b7e4..1560af8 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -627,12 +627,6 @@ public abstract class ConnectionService extends Service { } @Override - public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) { - String id = mIdByConnection.get(c); - Log.i(this, "Adapter onPhoneAccountChanged %s, %s", c, pHandle); - mAdapter.setPhoneAccountHandle(id, pHandle); - } - public void onCdmaConnectionTimeReset(Connection c) { String id = mIdByConnection.get(c); mAdapter.resetCdmaConnectionTime(id); @@ -692,7 +686,7 @@ public abstract class ConnectionService extends Service { callId, request, new ParcelableConnection( - getAccountHandle(request, connection), + request.getAccountHandle(), connection.getState(), connection.getConnectionCapabilities(), connection.getAddress(), @@ -714,18 +708,6 @@ public abstract class ConnectionService extends Service { } } - /** @hide */ - public PhoneAccountHandle getAccountHandle( - final ConnectionRequest request, Connection connection) { - PhoneAccountHandle pHandle = connection.getPhoneAccountHandle(); - if (pHandle != null) { - Log.i(this, "getAccountHandle, return account handle from local, %s", pHandle); - return pHandle; - } else { - return request.getAccountHandle(); - } - } - private void abort(String callId) { Log.d(this, "abort %s", callId); findConnectionForAction(callId, "abort").onAbort(); diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index f59427d..30bd373 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -424,14 +424,4 @@ final class ConnectionServiceAdapter implements DeathRecipient { } } } - - void setPhoneAccountHandle(String callId, PhoneAccountHandle pHandle) { - Log.v(this, "setPhoneAccountHandle: %s, %s", callId, pHandle); - for (IConnectionServiceAdapter adapter : mAdapters) { - try { - adapter.setPhoneAccountHandle(callId, pHandle); - } catch (RemoteException ignored) { - } - } - } } diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java index feaa89e..b8e7c22 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java @@ -62,7 +62,6 @@ final class ConnectionServiceAdapterServant { private static final int MSG_ON_POST_DIAL_CHAR = 22; private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23; private static final int MSG_SET_EXTRAS = 24; - private static final int MSG_SET_PHONE_ACCOUNT = 25; private final IConnectionServiceAdapter mDelegate; @@ -224,16 +223,6 @@ final class ConnectionServiceAdapterServant { } break; } - case MSG_SET_PHONE_ACCOUNT: { - SomeArgs args = (SomeArgs) msg.obj; - try { - mDelegate.setPhoneAccountHandle( - (String) args.arg1, (PhoneAccountHandle) args.arg2); - } finally { - args.recycle(); - } - break; - } case MSG_SET_CONFERENCE_MERGE_FAILED: { SomeArgs args = (SomeArgs) msg.obj; try { @@ -431,13 +420,6 @@ final class ConnectionServiceAdapterServant { mHandler.obtainMessage(MSG_SET_EXTRAS, args).sendToTarget(); } - public final void setPhoneAccountHandle(String connectionId, PhoneAccountHandle pHandle) { - SomeArgs args = SomeArgs.obtain(); - args.arg1 = connectionId; - args.arg2 = pHandle; - mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT, args).sendToTarget(); - } - @Override public void resetCdmaConnectionTime(String callId) { } diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index 3cb8058..f960959 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -209,11 +209,6 @@ public final class RemoteConnection { * @param extras The extras containing other information associated with the connection. */ public void onExtrasChanged(RemoteConnection connection, @Nullable Bundle extras) {} - - /** @hide */ - public void setPhoneAccountHandle( - RemoteConnection connection, - PhoneAccountHandle pHandle) {} } /** @@ -1296,20 +1291,6 @@ public final class RemoteConnection { } } - /** @hide */ - void setPhoneAccountHandle(final PhoneAccountHandle pHandle) { - for (CallbackRecord record : mCallbackRecords) { - final RemoteConnection connection = this; - final Callback callback = record.getCallback(); - record.getHandler().post(new Runnable() { - @Override - public void run() { - callback.setPhoneAccountHandle(connection, pHandle); - } - }); - } - } - /** * Create a RemoteConnection represents a failure, and which will be in * {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java index eead32a..372d736 100644 --- a/telecomm/java/android/telecom/RemoteConnectionService.java +++ b/telecomm/java/android/telecom/RemoteConnectionService.java @@ -331,11 +331,6 @@ final class RemoteConnectionService { } } - public void setPhoneAccountHandle(String callId, PhoneAccountHandle pHandle) { - findConnectionForAction(callId, "setPhoneAccountHandle") - .setPhoneAccountHandle(pHandle); - } - @Override public void resetCdmaConnectionTime(String callId) { } diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl index aaefbaf..ef4915c 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl @@ -23,7 +23,6 @@ import android.telecom.ConnectionRequest; import android.telecom.DisconnectCause; import android.telecom.ParcelableConnection; import android.telecom.ParcelableConference; -import android.telecom.PhoneAccountHandle; import android.telecom.StatusHints; import com.android.internal.telecom.IVideoProvider; @@ -88,7 +87,5 @@ oneway interface IConnectionServiceAdapter { void setExtras(String callId, in Bundle extras); - void setPhoneAccountHandle(String callId, in PhoneAccountHandle pHandle); - void resetCdmaConnectionTime(String callId); } diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java index 4dacb4a..e2e8326 100644 --- a/telephony/java/android/telephony/DisconnectCause.java +++ b/telephony/java/android/telephony/DisconnectCause.java @@ -257,11 +257,10 @@ public class DisconnectCause { public static final int INTERWORKING_UNSPECIFIED = 90; public static final int LOCAL_LOW_BATTERY = 91; public static final int LOW_BATTERY = 92; - /** EMERGENCY call failed with temporary fail cause */ - public static final int EMERGENCY_TEMP_FAILURE = 91; + public static final int EMERGENCY_TEMP_FAILURE = 93; /** EMERGENCY call failed with permanent fail cause */ - public static final int EMERGENCY_PERM_FAILURE = 92; + public static final int EMERGENCY_PERM_FAILURE = 94; /** Private constructor to avoid class instantiation. */ private DisconnectCause() { diff --git a/telephony/java/com/android/ims/ImsCallProfile.java b/telephony/java/com/android/ims/ImsCallProfile.java index f263b4d..d73b2bd 100644 --- a/telephony/java/com/android/ims/ImsCallProfile.java +++ b/telephony/java/com/android/ims/ImsCallProfile.java @@ -187,6 +187,7 @@ public class ImsCallProfile implements Parcelable { public static final String EXTRA_CODEC = "Codec"; public static final String EXTRA_DISPLAY_TEXT = "DisplayText"; public static final String EXTRA_ADDITIONAL_CALL_INFO = "AdditionalCallInfo"; + public static final String EXTRA_IS_CALL_PULL = "CallPull"; public int mServiceType; public int mCallType; diff --git a/telephony/java/com/android/ims/ImsReasonInfo.java b/telephony/java/com/android/ims/ImsReasonInfo.java index 0244209..3ab415c 100644 --- a/telephony/java/com/android/ims/ImsReasonInfo.java +++ b/telephony/java/com/android/ims/ImsReasonInfo.java @@ -241,6 +241,16 @@ public class ImsReasonInfo implements Parcelable { public static final int CODE_ANSWERED_ELSEWHERE = 1014; /** + * For VICE - Call Pull request has failed + */ + public static final int CODE_CALL_PULL_OUT_OF_SYNC = 1015; + + /** + * For VICE - Call has been pulled from primary to secondary + */ + public static final int CODE_CALL_END_CAUSE_CALL_PULL = 1016; + + /** * Network string error messages. * mExtraMessage may have these values. */ diff --git a/telephony/java/com/android/ims/ImsStreamMediaProfile.java b/telephony/java/com/android/ims/ImsStreamMediaProfile.java index 5a99212..216cef5 100644 --- a/telephony/java/com/android/ims/ImsStreamMediaProfile.java +++ b/telephony/java/com/android/ims/ImsStreamMediaProfile.java @@ -51,6 +51,16 @@ public class ImsStreamMediaProfile implements Parcelable { public static final int AUDIO_QUALITY_GSM_EFR = 8; public static final int AUDIO_QUALITY_GSM_FR = 9; public static final int AUDIO_QUALITY_GSM_HR = 10; + public static final int AUDIO_QUALITY_G711U = 11; + public static final int AUDIO_QUALITY_G723 = 12; + public static final int AUDIO_QUALITY_G711A = 13; + public static final int AUDIO_QUALITY_G722 = 14; + public static final int AUDIO_QUALITY_G711AB = 15; + public static final int AUDIO_QUALITY_G729 = 16; + public static final int AUDIO_QUALITY_EVS_NB = 17; + public static final int AUDIO_QUALITY_EVS_WB = 18; + public static final int AUDIO_QUALITY_EVS_SWB = 19; + public static final int AUDIO_QUALITY_EVS_FB = 20; /** * Video information diff --git a/telephony/java/com/android/internal/telephony/TelephonyProperties.java b/telephony/java/com/android/internal/telephony/TelephonyProperties.java index bb9e7c0..73e778c 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java +++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java @@ -253,4 +253,13 @@ public interface TelephonyProperties * if false: normal dial */ static final String ADD_PARTICIPANT_KEY = "add_participant"; + + /** + * For VICE Feature + * If true: Dial intent is for call pull functionality + * if false: normal dial + */ + static final String EXTRA_IS_CALL_PULL = + "org.codeaurora.extra.IS_CALL_PULL"; + } |