Merge "Import translations. DO NOT MERGE" into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index e1c83e5..3c878c8 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -30587,6 +30587,13 @@
method public int describeContents();
method public int getQuality();
method public int getVideoState();
+ method public static boolean isAudioOnly(int);
+ method public static boolean isBidirectional(int);
+ method public static boolean isPaused(int);
+ method public static boolean isReceptionEnabled(int);
+ method public static boolean isTransmissionEnabled(int);
+ method public static boolean isVideo(int);
+ method public static java.lang.String videoStateToString(int);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR;
field public static final int QUALITY_DEFAULT = 4; // 0x4
@@ -30609,15 +30616,6 @@
field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR;
}
- public static class VideoProfile.VideoState {
- method public static boolean isAudioOnly(int);
- method public static boolean isBidirectional(int);
- method public static boolean isPaused(int);
- method public static boolean isReceptionEnabled(int);
- method public static boolean isTransmissionEnabled(int);
- method public static java.lang.String videoStateToString(int);
- }
-
}
package android.telephony {
diff --git a/api/system-current.txt b/api/system-current.txt
index 2839f68..65ca29a 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -32801,6 +32801,13 @@
method public int describeContents();
method public int getQuality();
method public int getVideoState();
+ method public static boolean isAudioOnly(int);
+ method public static boolean isBidirectional(int);
+ method public static boolean isPaused(int);
+ method public static boolean isReceptionEnabled(int);
+ method public static boolean isTransmissionEnabled(int);
+ method public static boolean isVideo(int);
+ method public static java.lang.String videoStateToString(int);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR;
field public static final int QUALITY_DEFAULT = 4; // 0x4
@@ -32823,15 +32830,6 @@
field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR;
}
- public static class VideoProfile.VideoState {
- method public static boolean isAudioOnly(int);
- method public static boolean isBidirectional(int);
- method public static boolean isPaused(int);
- method public static boolean isReceptionEnabled(int);
- method public static boolean isTransmissionEnabled(int);
- method public static java.lang.String videoStateToString(int);
- }
-
}
package android.telephony {
diff --git a/cmds/telecom/Android.mk b/cmds/telecom/Android.mk
new file mode 100644
index 0000000..5f7bdf7
--- /dev/null
+++ b/cmds/telecom/Android.mk
@@ -0,0 +1,15 @@
+# Copyright 2015 The Android Open Source Project
+#
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_MODULE := telecom
+include $(BUILD_JAVA_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := telecom
+LOCAL_SRC_FILES := telecom
+LOCAL_MODULE_CLASS := EXECUTABLES
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_PREBUILT)
diff --git a/cmds/telecom/MODULE_LICENSE_APACHE2 b/cmds/telecom/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/cmds/telecom/MODULE_LICENSE_APACHE2
diff --git a/cmds/telecom/NOTICE b/cmds/telecom/NOTICE
new file mode 100644
index 0000000..8530865
--- /dev/null
+++ b/cmds/telecom/NOTICE
@@ -0,0 +1,190 @@
+
+ Copyright (c) 2015, 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.
+
+ 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.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
diff --git a/cmds/telecom/src/com/android/commands/telecom/Telecom.java b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
new file mode 100644
index 0000000..250b002
--- /dev/null
+++ b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
@@ -0,0 +1,134 @@
+/*
+ * 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.commands.telecom;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.telecom.PhoneAccountHandle;
+import android.text.TextUtils;
+
+import com.android.internal.os.BaseCommand;
+import com.android.internal.telecom.ITelecomService;
+
+import java.io.PrintStream;
+
+public final class Telecom extends BaseCommand {
+
+ /**
+ * Command-line entry point.
+ *
+ * @param args The command-line arguments
+ */
+ public static void main(String[] args) {
+ (new Telecom()).run(args);
+ }
+
+ private static final String COMMAND_SET_PHONE_ACOUNT_ENABLED = "set-phone-account-enabled";
+ private static final String COMMAND_SET_PHONE_ACOUNT_DISABLED = "set-phone-account-disabled";
+ private static final String COMMAND_SET_DEFAULT_DIALER = "set-default-dialer";
+ private static final String COMMAND_GET_DEFAULT_DIALER = "get-default-dialer";
+
+ private ComponentName mComponent;
+ private String mAccountId;
+ private ITelecomService mTelecomService;
+
+ @Override
+ public void onShowUsage(PrintStream out) {
+ out.println(
+ "usage: telecom [subcommand] [options]\n" +
+ "usage: telecom set-phone-account-enabled <COMPONENT> <ID>\n" +
+ "usage: telecom set-phone-account-disabled <COMPONENT> <ID>\n" +
+ "usage: telecom set-default-dialer <PACKAGE>\n" +
+ "usage: telecom get-default-dialer <PACKAGE>\n" +
+ "\n" +
+ "telecom set-phone-account-enabled: Enables the given phone account, if it has \n" +
+ " already been registered with Telecom.\n" +
+ "\n" +
+ "telecom set-phone-account-disabled: Disables the given phone account, if it \n" +
+ " has already been registered with telecom.\n" +
+ "\n" +
+ "telecom set-default_dialer: Sets the default dialer to the given component. \n" +
+ "\n" +
+ "telecom get-default_dialer: Displays the current default dialer. \n"
+ );
+ }
+
+ @Override
+ public void onRun() throws Exception {
+ mTelecomService = ITelecomService.Stub.asInterface(
+ ServiceManager.getService(Context.TELECOM_SERVICE));
+ if (mTelecomService == null) {
+ showError("Error: Could not access the Telecom Manager. Is the system running?");
+ return;
+ }
+
+ String command = nextArgRequired();
+ switch (command) {
+ case COMMAND_SET_PHONE_ACOUNT_ENABLED:
+ runSetPhoneAccountEnabled(true);
+ break;
+ case COMMAND_SET_PHONE_ACOUNT_DISABLED:
+ runSetPhoneAccountEnabled(false);
+ break;
+ case COMMAND_SET_DEFAULT_DIALER:
+ runSetDefaultDialer();
+ break;
+ case COMMAND_GET_DEFAULT_DIALER:
+ runGetDefaultDialer();
+ break;
+ default:
+ throw new IllegalArgumentException ("unknown command '" + command + "'");
+ }
+ }
+
+ private void runSetPhoneAccountEnabled(boolean enabled) throws RemoteException {
+ final ComponentName component = parseComponentName(nextArgRequired());
+ final String accountId = nextArgRequired();
+ final PhoneAccountHandle handle = new PhoneAccountHandle(component, accountId);
+ final boolean success = mTelecomService.enablePhoneAccount(handle, enabled);
+ if (success) {
+ System.out.println("Success - " + handle + (enabled ? " enabled." : " disabled."));
+ } else {
+ System.out.println("Error - is " + handle + " a valid PhoneAccount?");
+ }
+ }
+
+ private void runSetDefaultDialer() throws RemoteException {
+ final String packageName = nextArgRequired();
+ final boolean success = mTelecomService.setDefaultDialer(packageName);
+ if (success) {
+ System.out.println("Success - " + packageName + " set as default dialer.");
+ } else {
+ System.out.println("Error - " + packageName + " is not an installed Dialer app, \n"
+ + " or is already the default dialer.");
+ }
+ }
+
+ private void runGetDefaultDialer() throws RemoteException {
+ System.out.println(mTelecomService.getDefaultDialerPackage());
+ }
+
+ private ComponentName parseComponentName(String component) {
+ ComponentName cn = ComponentName.unflattenFromString(component);
+ if (cn == null) {
+ throw new IllegalArgumentException ("Invalid component " + component);
+ }
+ return cn;
+ }
+}
\ No newline at end of file
diff --git a/cmds/telecom/telecom b/cmds/telecom/telecom
new file mode 100755
index 0000000..9efdcfd
--- /dev/null
+++ b/cmds/telecom/telecom
@@ -0,0 +1,6 @@
+# Script to start "telecom" on the device
+#
+base=/system
+export CLASSPATH=$base/framework/telecom.jar
+exec app_process $base/bin com.android.commands.telecom.Telecom "$@"
+
diff --git a/core/java/android/security/keymaster/KeymasterDefs.java b/core/java/android/security/keymaster/KeymasterDefs.java
index 0e2b8ba..b450a6b 100644
--- a/core/java/android/security/keymaster/KeymasterDefs.java
+++ b/core/java/android/security/keymaster/KeymasterDefs.java
@@ -50,8 +50,7 @@
public static final int KM_TAG_BLOCK_MODE = KM_ENUM_REP | 4;
public static final int KM_TAG_DIGEST = KM_ENUM_REP | 5;
public static final int KM_TAG_PADDING = KM_ENUM_REP | 6;
- public static final int KM_TAG_RETURN_UNAUTHED = KM_BOOL | 7;
- public static final int KM_TAG_CALLER_NONCE = KM_BOOL | 8;
+ public static final int KM_TAG_CALLER_NONCE = KM_BOOL | 7;
public static final int KM_TAG_RESCOPING_ADD = KM_ENUM_REP | 101;
public static final int KM_TAG_RESCOPING_DEL = KM_ENUM_REP | 102;
@@ -82,7 +81,7 @@
public static final int KM_TAG_ASSOCIATED_DATA = KM_BYTES | 1000;
public static final int KM_TAG_NONCE = KM_BYTES | 1001;
- public static final int KM_TAG_CHUNK_LENGTH = KM_INT | 1002;
+ public static final int KM_TAG_AEAD_TAG = KM_BYTES | 1002;
public static final int KM_TAG_AUTH_TOKEN = KM_BYTES | 1003;
public static final int KM_TAG_MAC_LENGTH = KM_INT | 1004;
@@ -194,7 +193,7 @@
public static final int KM_ERROR_UNSUPPORTED_EC_FIELD = -50;
public static final int KM_ERROR_MISSING_NONCE = -51;
public static final int KM_ERROR_INVALID_NONCE = -52;
- public static final int KM_ERROR_UNSUPPORTED_CHUNK_LENGTH = -53;
+ public static final int KM_ERROR_MISSING_MAC_LENGTH = -53;
public static final int KM_ERROR_RESCOPABLE_KEY_NOT_USABLE = -54;
public static final int KM_ERROR_CALLER_NONCE_PROHIBITED = -55;
public static final int KM_ERROR_UNIMPLEMENTED = -100;
diff --git a/core/res/res/drawable/floating_popup_background.xml b/core/res/res/drawable/floating_popup_background.xml
new file mode 100644
index 0000000..b6700b3
--- /dev/null
+++ b/core/res/res/drawable/floating_popup_background.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="?attr/colorBackgroundFloating" />
+ <corners android:radius="2dp" />
+</shape>
+
diff --git a/core/res/res/layout/floating_popup_close_overflow_button.xml b/core/res/res/layout/floating_popup_close_overflow_button.xml
index a1d2811..0dbf7f7 100644
--- a/core/res/res/layout/floating_popup_close_overflow_button.xml
+++ b/core/res/res/layout/floating_popup_close_overflow_button.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
/* Copyright 2015, The Android Open Source Project
**
diff --git a/core/res/res/layout/floating_popup_container.xml b/core/res/res/layout/floating_popup_container.xml
index c2b4ccc..f37aee15 100644
--- a/core/res/res/layout/floating_popup_container.xml
+++ b/core/res/res/layout/floating_popup_container.xml
@@ -24,4 +24,4 @@
android:elevation="2dp"
android:focusable="true"
android:focusableInTouchMode="true"
- android:background="?attr/colorBackgroundFloating"/>
+ android:background="@drawable/floating_popup_background"/>
diff --git a/core/res/res/layout/floating_popup_menu_button.xml b/core/res/res/layout/floating_popup_menu_button.xml
index 23ae7f0..b549198 100644
--- a/core/res/res/layout/floating_popup_menu_button.xml
+++ b/core/res/res/layout/floating_popup_menu_button.xml
@@ -24,9 +24,10 @@
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:layout_margin="0dp"
+ android:gravity="center"
android:singleLine="true"
android:ellipsize="end"
- android:fontFamily="sans-serif"
+ android:fontFamily="sans-serif-medium"
android:textSize="@dimen/floating_toolbar_text_size"
android:textAllCaps="true"
android:textColor="?attr/colorForeground"
diff --git a/core/res/res/layout/floating_popup_menu_image_button.xml b/core/res/res/layout/floating_popup_menu_image_button.xml
index 5934136..07eb7a3 100644
--- a/core/res/res/layout/floating_popup_menu_image_button.xml
+++ b/core/res/res/layout/floating_popup_menu_image_button.xml
@@ -16,17 +16,21 @@
*/
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="@dimen/floating_toolbar_menu_button_minimum_width"
- android:layout_height="@dimen/floating_toolbar_height"
- android:minWidth="@dimen/floating_toolbar_menu_button_minimum_width"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:minWidth="@dimen/floating_toolbar_menu_image_button_width"
android:minHeight="@dimen/floating_toolbar_height"
android:focusable="false"
android:focusableInTouchMode="false"
android:importantForAccessibility="no">
<ImageButton
android:id="@+id/floating_toolbar_menu_item_image_button"
- android:layout_width="@dimen/floating_toolbar_menu_button_minimum_width"
+ android:layout_width="@dimen/floating_toolbar_menu_image_button_width"
android:layout_height="@dimen/floating_toolbar_height"
+ android:paddingStart="@dimen/floating_toolbar_menu_button_side_padding"
+ android:paddingTop="@dimen/floating_toolbar_menu_image_button_vertical_padding"
+ android:paddingEnd="@dimen/floating_toolbar_menu_button_side_padding"
+ android:paddingBottom="@dimen/floating_toolbar_menu_image_button_vertical_padding"
android:scaleType="centerInside"
android:background="?attr/selectableItemBackground" />
</LinearLayout>
diff --git a/core/res/res/layout/floating_popup_open_overflow_button.xml b/core/res/res/layout/floating_popup_open_overflow_button.xml
index dca5384..3027565 100644
--- a/core/res/res/layout/floating_popup_open_overflow_button.xml
+++ b/core/res/res/layout/floating_popup_open_overflow_button.xml
@@ -20,6 +20,10 @@
android:layout_height="match_parent"
android:minWidth="@dimen/floating_toolbar_menu_button_minimum_width"
android:minHeight="@dimen/floating_toolbar_height"
+ android:paddingStart="0dp"
+ android:paddingTop="0dp"
+ android:paddingBottom="0dp"
+ android:paddingEnd="4dp"
android:src="@drawable/ic_menu_moreoverflow_material"
android:contentDescription="@string/floating_toolbar_open_overflow_description"
android:background="?attr/selectableItemBackgroundBorderless" />
diff --git a/core/res/res/layout/floating_popup_overflow_image_list_item.xml b/core/res/res/layout/floating_popup_overflow_image_list_item.xml
index 9988ad5..fc04b31 100644
--- a/core/res/res/layout/floating_popup_overflow_image_list_item.xml
+++ b/core/res/res/layout/floating_popup_overflow_image_list_item.xml
@@ -16,17 +16,21 @@
*/
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="@dimen/floating_toolbar_menu_button_minimum_width"
- android:layout_height="@dimen/floating_toolbar_height"
- android:minWidth="@dimen/floating_toolbar_menu_button_minimum_width"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:minWidth="@dimen/floating_toolbar_overflow_image_button_width"
android:minHeight="@dimen/floating_toolbar_height"
android:focusable="false"
android:focusableInTouchMode="false"
android:importantForAccessibility="no">
<ImageView
android:id="@+id/floating_toolbar_menu_item_image_button"
- android:layout_width="@dimen/floating_toolbar_menu_button_minimum_width"
+ android:layout_width="@dimen/floating_toolbar_overflow_image_button_width"
android:layout_height="@dimen/floating_toolbar_height"
- android:layout_marginStart="18dp"
+ android:paddingTop="@dimen/floating_toolbar_menu_image_button_vertical_padding"
+ android:paddingStart="@dimen/floating_toolbar_overflow_side_padding"
+ android:paddingBottom="@dimen/floating_toolbar_menu_image_button_vertical_padding"
+ android:paddingEnd="@dimen/floating_toolbar_overflow_side_padding"
+ android:layout_margin="0dp"
android:scaleType="centerInside"/>
</LinearLayout>
diff --git a/core/res/res/layout/floating_popup_overflow_list_item b/core/res/res/layout/floating_popup_overflow_list_item.xml
similarity index 93%
rename from core/res/res/layout/floating_popup_overflow_list_item
rename to core/res/res/layout/floating_popup_overflow_list_item.xml
index 59a6d7e..2ff45bb 100644
--- a/core/res/res/layout/floating_popup_overflow_list_item
+++ b/core/res/res/layout/floating_popup_overflow_list_item.xml
@@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
- android:gravity="center_vertical"
+ android:gravity="start|center_vertical"
android:minWidth="@dimen/floating_toolbar_menu_button_side_padding"
android:minHeight="@dimen/floating_toolbar_height"
android:paddingStart="@dimen/floating_toolbar_overflow_side_padding"
@@ -29,7 +29,8 @@
android:layout_margin="0dp"
android:singleLine="true"
android:ellipsize="end"
- android:fontFamily="sans-serif"
+ android:fontFamily="sans-serif-medium"
android:textSize="@dimen/floating_toolbar_text_size"
android:textColor="?attr/colorForeground"
android:textAllCaps="true" />
+
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 9a15278..3c84b5e 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1763,6 +1763,12 @@
<string name="config_customAdbPublicKeyConfirmationComponent"
>com.android.systemui/com.android.systemui.usb.UsbDebuggingActivity</string>
+ <!-- Name of the activity that prompts the secondary user to acknowledge she/he needs to
+ switch to the primary user to enable USB debugging.
+ Can be customized for other product types -->
+ <string name="config_customAdbPublicKeyConfirmationSecondaryUserComponent"
+ >com.android.systemui/com.android.systemui.usb.UsbDebuggingSecondaryUserActivity</string>
+
<!-- Name of the CustomDialog that is used for VPN -->
<string name="config_customVpnConfirmDialogComponent"
>com.android.vpndialogs/com.android.vpndialogs.ConfirmDialog</string>
@@ -2172,4 +2178,13 @@
Defaults to the older, deprecated config_windowIsRound already used in
some existing device-specific resource overlays. -->
<bool name="config_mainBuiltInDisplayIsRound">@bool/config_windowIsRound</bool>
+
+ <!-- Ultrasound support for Mic/speaker path -->
+ <!-- Whether the default microphone audio source supports near-ultrasound frequencies
+ (range of 18 - 21 kHz). -->
+ <bool name="config_supportMicNearUltrasound">true</bool>
+ <!-- Whether the default speaker audio output path supports near-ultrasound frequencies
+ (range of 18 - 21 kHz). -->
+ <bool name="config_supportSpeakerNearUltrasound">true</bool>
+
</resources>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 813591b..e60a48d 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -387,7 +387,10 @@
<!-- Floating toolbar dimensions -->
<dimen name="floating_toolbar_height">48dp</dimen>
+ <dimen name="floating_toolbar_menu_image_button_width">56dp</dimen>
+ <dimen name="floating_toolbar_menu_image_button_vertical_padding">12dp</dimen>
<dimen name="floating_toolbar_menu_button_side_padding">16dp</dimen>
+ <dimen name="floating_toolbar_overflow_image_button_width">60dp</dimen>
<dimen name="floating_toolbar_overflow_side_padding">18dp</dimen>
<dimen name="floating_toolbar_text_size">14sp</dimen>
<dimen name="floating_toolbar_menu_button_minimum_width">48dp</dimen>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 9d56f13..acb6c6a 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -301,6 +301,8 @@
<java-symbol type="bool" name="config_wifi_only_link_same_credential_configurations" />
<java-symbol type="bool" name="config_wifi_enable_disconnection_debounce" />
<java-symbol type="bool" name="config_wifi_enable_5GHz_preference" />
+ <java-symbol type="bool" name="config_supportMicNearUltrasound" />
+ <java-symbol type="bool" name="config_supportSpeakerNearUltrasound" />
<java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_threshold" />
<java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_factor" />
<java-symbol type="integer" name="config_wifi_framework_5GHz_preference_penalty_threshold" />
@@ -1825,6 +1827,7 @@
<java-symbol type="integer" name="config_maximumScreenDimDuration" />
<java-symbol type="fraction" name="config_maximumScreenDimRatio" />
<java-symbol type="string" name="config_customAdbPublicKeyConfirmationComponent" />
+ <java-symbol type="string" name="config_customAdbPublicKeyConfirmationSecondaryUserComponent" />
<java-symbol type="string" name="config_customVpnConfirmDialogComponent" />
<java-symbol type="string" name="config_defaultNetworkScorerPackageName" />
<java-symbol type="string" name="config_persistentDataPackageName" />
diff --git a/keystore/tests/src/android/security/KeyStoreTest.java b/keystore/tests/src/android/security/KeyStoreTest.java
index 1875885b..e048ec9 100644
--- a/keystore/tests/src/android/security/KeyStoreTest.java
+++ b/keystore/tests/src/android/security/KeyStoreTest.java
@@ -806,8 +806,6 @@
args.addInt(KeymasterDefs.KM_TAG_PADDING, KeymasterDefs.KM_PAD_NONE);
args.addInt(KeymasterDefs.KM_TAG_KEY_SIZE, 256);
args.addInt(KeymasterDefs.KM_TAG_BLOCK_MODE, KeymasterDefs.KM_MODE_GCM);
- args.addInt(KeymasterDefs.KM_TAG_CHUNK_LENGTH, 4096);
- args.addInt(KeymasterDefs.KM_TAG_MAC_LENGTH, 16);
args.addBoolean(KeymasterDefs.KM_TAG_NO_AUTH_REQUIRED);
KeyCharacteristics outCharacteristics = new KeyCharacteristics();
@@ -818,6 +816,7 @@
args.addInt(KeymasterDefs.KM_TAG_ALGORITHM, KeymasterDefs.KM_ALGORITHM_AES);
args.addInt(KeymasterDefs.KM_TAG_BLOCK_MODE, KeymasterDefs.KM_MODE_GCM);
args.addInt(KeymasterDefs.KM_TAG_PADDING, KeymasterDefs.KM_PAD_NONE);
+ args.addInt(KeymasterDefs.KM_TAG_MAC_LENGTH, 128);
OperationResult result = mKeyStore.begin(name, KeymasterDefs.KM_PURPOSE_ENCRYPT,
true, args, null);
IBinder token = result.token;
@@ -826,6 +825,7 @@
assertEquals("Update should succeed", KeyStore.NO_ERROR, result.resultCode);
assertEquals("Finish should succeed", KeyStore.NO_ERROR,
mKeyStore.finish(token, null, null).resultCode);
+ // TODO: Assert that an AEAD tag was returned by finish
}
public void testBadToken() throws Exception {
diff --git a/libs/hwui/FrameInfo.cpp b/libs/hwui/FrameInfo.cpp
index c24833b..85998f1 100644
--- a/libs/hwui/FrameInfo.cpp
+++ b/libs/hwui/FrameInfo.cpp
@@ -20,7 +20,7 @@
namespace android {
namespace uirenderer {
-std::string FrameInfoNames[] = {
+const std::string FrameInfoNames[] = {
"Flags",
"IntendedVsync",
"Vsync",
diff --git a/libs/hwui/FrameInfo.h b/libs/hwui/FrameInfo.h
index bcfae1b..38a6a21 100644
--- a/libs/hwui/FrameInfo.h
+++ b/libs/hwui/FrameInfo.h
@@ -50,7 +50,7 @@
kNumIndexes
};
-extern std::string FrameInfoNames[];
+extern const std::string FrameInfoNames[];
enum class FrameInfoFlags {
kWindowLayoutChanged = 1 << 0,
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index f8490b6..acf9c13 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -401,7 +401,7 @@
FILE* file = fdopen(fd, "a");
fprintf(file, "\n\n---PROFILEDATA---\n");
for (size_t i = 0; i < static_cast<size_t>(FrameInfoIndex::kNumIndexes); i++) {
- fprintf(file, FrameInfoNames[i].c_str());
+ fprintf(file, "%s", FrameInfoNames[i].c_str());
fprintf(file, ",");
}
for (size_t i = 0; i < mFrames.size(); i++) {
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 316ccf6..33db9cf 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -38,7 +38,6 @@
import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
-import android.os.SystemProperties;
import android.os.SystemClock;
import android.os.ServiceManager;
import android.provider.Settings;
@@ -69,16 +68,6 @@
private static final AudioPortEventHandler sAudioPortEventHandler = new AudioPortEventHandler();
/**
- * System properties for whether the default microphone and speaker paths support
- * near-ultrasound frequencies (range of 18 - 21 kHz).
- */
- private static final String SYSTEM_PROPERTY_MIC_NEAR_ULTRASOUND =
- "persist.audio.mic.ultrasound";
- private static final String SYSTEM_PROPERTY_SPEAKER_NEAR_ULTRASOUND =
- "persist.audio.spkr.ultrasound";
- private static final String DEFAULT_RESULT_FALSE_STRING = "false";
-
- /**
* Broadcast intent, a hint for applications that audio is about to become
* 'noisy' due to a change in audio outputs. For example, this intent may
* be sent when a wired headset is unplugged, or when an A2DP audio
@@ -3213,11 +3202,13 @@
int outputFramesPerBuffer = AudioSystem.getPrimaryOutputFrameCount();
return outputFramesPerBuffer > 0 ? Integer.toString(outputFramesPerBuffer) : null;
} else if (PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND.equals(key)) {
- return SystemProperties.get(SYSTEM_PROPERTY_MIC_NEAR_ULTRASOUND,
- DEFAULT_RESULT_FALSE_STRING);
+ // Will throw a RuntimeException Resources.NotFoundException if this config value is
+ // not found.
+ return String.valueOf(getContext().getResources().getBoolean(
+ com.android.internal.R.bool.config_supportMicNearUltrasound));
} else if (PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND.equals(key)) {
- return SystemProperties.get(SYSTEM_PROPERTY_SPEAKER_NEAR_ULTRASOUND,
- DEFAULT_RESULT_FALSE_STRING);
+ return String.valueOf(getContext().getResources().getBoolean(
+ com.android.internal.R.bool.config_supportSpeakerNearUltrasound));
} else {
// null or unknown key
return null;
diff --git a/media/java/android/media/Image.java b/media/java/android/media/Image.java
index e18e9a3..045216b 100644
--- a/media/java/android/media/Image.java
+++ b/media/java/android/media/Image.java
@@ -228,7 +228,9 @@
if (cropRect != null) {
cropRect = new Rect(cropRect); // make a copy
- cropRect.intersect(0, 0, getWidth(), getHeight());
+ if (!cropRect.intersect(0, 0, getWidth(), getHeight())) {
+ cropRect.setEmpty();
+ }
}
mCropRect = cropRect;
}
diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
index 4c907a3..d876264 100644
--- a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
+++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
@@ -66,6 +66,7 @@
private NetworkCallback mNetworkCallback;
private ConnectivityManager mCm;
private boolean mLaunchBrowser = false;
+ private MyWebViewClient mWebViewClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -115,7 +116,8 @@
myWebView.clearCache(true);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
- myWebView.setWebViewClient(new MyWebViewClient());
+ mWebViewClient = new MyWebViewClient();
+ myWebView.setWebViewClient(mWebViewClient);
myWebView.setWebChromeClient(new MyWebChromeClient());
// Start initial page load so WebView finishes loading proxy settings.
// Actual load of mUrl is initiated by MyWebViewClient.
@@ -174,7 +176,7 @@
@Override
public void onBackPressed() {
WebView myWebView = (WebView) findViewById(R.id.webview);
- if (myWebView.canGoBack()) {
+ if (myWebView.canGoBack() && mWebViewClient.allowBack()) {
myWebView.goBack();
} else {
super.onBackPressed();
@@ -255,7 +257,12 @@
getResources().getDisplayMetrics()) /
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1,
getResources().getDisplayMetrics());
- private boolean mFirstPageLoad = true;
+ private int mPagesLoaded;
+
+ // If we haven't finished cleaning up the history, don't allow going back.
+ public boolean allowBack() {
+ return mPagesLoaded > 1;
+ }
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
@@ -264,26 +271,32 @@
done(Result.WANTED_AS_IS);
return;
}
- if (mFirstPageLoad) return;
+ // The first page load is used only to cause the WebView to
+ // fetch the proxy settings. Don't update the URL bar, and
+ // don't check if the captive portal is still there.
+ if (mPagesLoaded == 0) return;
+ // For internally generated pages, leave URL bar listing prior URL as this is the URL
+ // the page refers to.
+ if (!url.startsWith(INTERNAL_ASSETS)) {
+ final TextView myUrlBar = (TextView) findViewById(R.id.url_bar);
+ myUrlBar.setText(url);
+ }
testForCaptivePortal();
}
@Override
public void onPageFinished(WebView view, String url) {
- if (mFirstPageLoad) {
- mFirstPageLoad = false;
+ mPagesLoaded++;
+ if (mPagesLoaded == 1) {
// Now that WebView has loaded at least one page we know it has read in the proxy
// settings. Now prompt the WebView read the Network-specific proxy settings.
setWebViewProxy();
// Load the real page.
view.loadUrl(mURL.toString());
return;
- }
- // For internally generated pages, leave URL bar listing prior URL as this is the URL
- // the page refers to.
- if (!url.startsWith(INTERNAL_ASSETS)) {
- final TextView myUrlBar = (TextView) findViewById(R.id.url_bar);
- myUrlBar.setText(url);
+ } else if (mPagesLoaded == 2) {
+ // Prevent going back to empty first page.
+ view.clearHistory();
}
testForCaptivePortal();
}
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index cc8e46b..c259573 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -276,6 +276,11 @@
android:finishOnCloseSystemDialogs="true"
android:excludeFromRecents="true">
</activity>
+ <activity android:name=".usb.UsbDebuggingSecondaryUserActivity"
+ android:theme="@style/Theme.SystemUI.Dialog.Alert"
+ android:finishOnCloseSystemDialogs="true"
+ android:excludeFromRecents="true">
+ </activity>
<!-- started from NetworkPolicyManagerService -->
<activity
diff --git a/packages/SystemUI/res/drawable/ripple_drawable_20dp.xml b/packages/SystemUI/res/drawable/ripple_drawable_20dp.xml
new file mode 100644
index 0000000..8d2a0f9
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ripple_drawable_20dp.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:radius="20dp"
+ android:color="?android:attr/colorControlHighlight" />
diff --git a/packages/SystemUI/res/layout/zen_mode_condition.xml b/packages/SystemUI/res/layout/zen_mode_condition.xml
index a169d1a..4953e6f 100644
--- a/packages/SystemUI/res/layout/zen_mode_condition.xml
+++ b/packages/SystemUI/res/layout/zen_mode_condition.xml
@@ -17,6 +17,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/qs_detail_item_height"
+ android:clipChildren="false"
android:layout_marginBottom="@dimen/zen_mode_condition_detail_item_spacing"
android:layout_marginStart="1dp"
android:layout_marginEnd="0dp" >
@@ -63,6 +64,7 @@
<ImageView
android:id="@android:id/button1"
style="@style/QSBorderlessButton"
+ android:background="@drawable/ripple_drawable_20dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
@@ -74,6 +76,7 @@
<ImageView
android:id="@android:id/button2"
style="@style/QSBorderlessButton"
+ android:background="@drawable/ripple_drawable_20dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 6af69d2..834d5dd 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -159,6 +159,12 @@
<!-- Option to always allow USB debugging from the attached computer -->
<string name="usb_debugging_always">Always allow from this computer</string>
+ <!-- Title of notification shown when trying to enable USB debugging but a secondary user is the current foreground user. -->
+ <string name="usb_debugging_secondary_user_title">USB debugging not allowed</string>
+
+ <!-- Message of notification shown when trying to enable USB debugging but a secondary user is the current foreground user. -->
+ <string name="usb_debugging_secondary_user_message">The user currently signed in to this device can\'t turn on USB debugging. To use this feature, switch to the primary user \u201C<xliff:g id="name" example="John Doe">%s</xliff:g>\u201D.</string>
+
<!-- Checkbox label for application compatibility mode ON (zooming app to look like it's running
on a phone). [CHAR LIMIT=25] -->
<string name="compat_mode_on">Zoom to fill screen</string>
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java
new file mode 100644
index 0000000..9ce771b
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2015 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.systemui.usb;
+
+import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.UserInfo;
+import android.hardware.usb.UsbManager;
+import android.os.Bundle;
+import android.os.SystemProperties;
+import android.os.UserHandle;
+import android.os.UserManager;
+
+import com.android.internal.app.AlertActivity;
+import com.android.internal.app.AlertController;
+import com.android.systemui.R;
+
+public class UsbDebuggingSecondaryUserActivity extends AlertActivity
+ implements DialogInterface.OnClickListener {
+ private UsbDisconnectedReceiver mDisconnectedReceiver;
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+
+ if (SystemProperties.getInt("service.adb.tcp.port", 0) == 0) {
+ mDisconnectedReceiver = new UsbDisconnectedReceiver(this);
+ }
+
+ final AlertController.AlertParams ap = mAlertParams;
+ ap.mTitle = getString(R.string.usb_debugging_secondary_user_title);
+ UserInfo user = UserManager.get(this).getUserInfo(UserHandle.USER_OWNER);
+ ap.mMessage = getString(R.string.usb_debugging_secondary_user_message, user.name);
+ ap.mPositiveButtonText = getString(android.R.string.ok);
+ ap.mPositiveButtonListener = this;
+
+ setupAlert();
+ }
+
+ private class UsbDisconnectedReceiver extends BroadcastReceiver {
+ private final Activity mActivity;
+ public UsbDisconnectedReceiver(Activity activity) {
+ mActivity = activity;
+ }
+
+ @Override
+ public void onReceive(Context content, Intent intent) {
+ String action = intent.getAction();
+ if (UsbManager.ACTION_USB_STATE.equals(action)) {
+ boolean connected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);
+ if (!connected) {
+ mActivity.finish();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+
+ IntentFilter filter = new IntentFilter(UsbManager.ACTION_USB_STATE);
+ registerReceiver(mDisconnectedReceiver, filter);
+ }
+
+ @Override
+ protected void onStop() {
+ if (mDisconnectedReceiver != null) {
+ unregisterReceiver(mDisconnectedReceiver);
+ }
+ super.onStop();
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ finish();
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
index 09f7074..310a64c 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
@@ -726,11 +726,6 @@
}
row.slider.setProgress(newProgress);
}
- if (mAutomute && mShowing) {
- if (vlevel == 0 && !row.ss.muted && row.stream == AudioManager.STREAM_MUSIC) {
- mController.setStreamMute(row.stream, true);
- }
- }
}
}
@@ -934,16 +929,6 @@
final int userLevel = getImpliedLevel(seekBar, progress);
if (mRow.ss.level != userLevel || mRow.ss.muted && userLevel > 0) {
mRow.userAttempt = SystemClock.uptimeMillis();
- if (mAutomute) {
- if (mRow.stream != AudioManager.STREAM_RING) {
- if (userLevel > 0 && mRow.ss.muted) {
- mController.setStreamMute(mRow.stream, false);
- }
- if (userLevel == 0 && mRow.ss.muteSupported && !mRow.ss.muted) {
- mController.setStreamMute(mRow.stream, true);
- }
- }
- }
if (mRow.requestedLevel != userLevel) {
mController.setStreamVolume(mRow.stream, userLevel);
mRow.requestedLevel = userLevel;
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 860939c..d4c3194 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -3240,8 +3240,7 @@
// Clip to the window bounds.
Rect windowBounds = mTempRect1;
getWindowBounds(focus.getWindowId(), windowBounds);
- boundsInScreen.intersect(windowBounds);
- if (boundsInScreen.isEmpty()) {
+ if (!boundsInScreen.intersect(windowBounds)) {
return false;
}
@@ -3255,8 +3254,7 @@
// Clip to the screen bounds.
Point screenSize = mTempPoint;
mDefaultDisplay.getRealSize(screenSize);
- boundsInScreen.intersect(0, 0, screenSize.x, screenSize.y);
- if (boundsInScreen.isEmpty()) {
+ if (!boundsInScreen.intersect(0, 0, screenSize.x, screenSize.y)) {
return false;
}
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 7135191..cd467bd 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -1368,10 +1368,11 @@
private void onSetStreamVolume(int streamType, int index, int flags, int device,
String caller) {
- setStreamVolumeInt(mStreamVolumeAlias[streamType], index, device, false, caller);
+ final int stream = mStreamVolumeAlias[streamType];
+ setStreamVolumeInt(stream, index, device, false, caller);
// setting volume on ui sounds stream type also controls silent mode
if (((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0) ||
- (mStreamVolumeAlias[streamType] == getUiSoundsStreamType())) {
+ (stream == getUiSoundsStreamType())) {
int newRingerMode;
if (index == 0) {
newRingerMode = mHasVibrator ? AudioManager.RINGER_MODE_VIBRATE
@@ -1382,6 +1383,8 @@
}
setRingerMode(newRingerMode, TAG + ".onSetStreamVolume", false /*external*/);
}
+ // setting non-zero volume for a muted stream unmutes the stream and vice versa
+ mStreamStates[stream].mute(index == 0);
}
/** @see AudioManager#setStreamVolume(int, int, int) */
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index eafcae4..31fa5c4 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -16,6 +16,7 @@
package com.android.server.notification;
+import static android.media.AudioAttributes.USAGE_ALARM;
import static android.media.AudioAttributes.USAGE_NOTIFICATION;
import static android.media.AudioAttributes.USAGE_NOTIFICATION_RINGTONE;
@@ -49,8 +50,8 @@
import android.util.Log;
import android.util.SparseArray;
-import com.android.internal.logging.MetricsLogger;
import com.android.internal.R;
+import com.android.internal.logging.MetricsLogger;
import com.android.server.LocalServices;
import libcore.io.IoUtils;
@@ -404,6 +405,10 @@
final boolean muteCalls = zen && !mConfig.allowCalls && !mConfig.allowRepeatCallers
|| mEffectsSuppressed;
applyRestrictions(muteCalls, USAGE_NOTIFICATION_RINGTONE);
+
+ // alarm restrictions
+ final boolean muteAlarms = mZenMode == Global.ZEN_MODE_NO_INTERRUPTIONS;
+ applyRestrictions(muteAlarms, USAGE_ALARM);
}
private void applyRestrictions(boolean mute, int usage) {
diff --git a/services/usb/java/com/android/server/usb/UsbDebuggingManager.java b/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
index 8849acd..9a04e8b 100644
--- a/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
@@ -16,6 +16,7 @@
package com.android.server.usb;
+import android.app.ActivityManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
@@ -24,20 +25,21 @@
import android.content.res.Resources;
import android.net.LocalSocket;
import android.net.LocalSocketAddress;
-import android.os.Handler;
import android.os.Environment;
import android.os.FileUtils;
+import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
-import android.util.Slog;
+import android.os.UserManager;
import android.util.Base64;
+import android.util.Slog;
+import com.android.internal.R;
import com.android.server.FgThread;
-import java.lang.Thread;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileOutputStream;
@@ -319,28 +321,39 @@
}
private void startConfirmation(String key, String fingerprints) {
- String nameString = Resources.getSystem().getString(
- com.android.internal.R.string.config_customAdbPublicKeyConfirmationComponent);
- ComponentName componentName = ComponentName.unflattenFromString(nameString);
- if (startConfirmationActivity(componentName, key, fingerprints)
- || startConfirmationService(componentName, key, fingerprints)) {
+ int currentUserId = ActivityManager.getCurrentUser();
+ UserHandle userHandle =
+ UserManager.get(mContext).getUserInfo(currentUserId).getUserHandle();
+ String componentString;
+ if (currentUserId == UserHandle.USER_OWNER) {
+ componentString = Resources.getSystem().getString(
+ com.android.internal.R.string.config_customAdbPublicKeyConfirmationComponent);
+ } else {
+ // If the current foreground user is not the primary user we send a different
+ // notification specific to secondary users.
+ componentString = Resources.getSystem().getString(
+ R.string.config_customAdbPublicKeyConfirmationSecondaryUserComponent);
+ }
+ ComponentName componentName = ComponentName.unflattenFromString(componentString);
+ if (startConfirmationActivity(componentName, userHandle, key, fingerprints)
+ || startConfirmationService(componentName, userHandle, key, fingerprints)) {
return;
}
- Slog.e(TAG, "unable to start customAdbPublicKeyConfirmationComponent "
- + nameString + " as an Activity or a Service");
+ Slog.e(TAG, "unable to start customAdbPublicKeyConfirmation[SecondaryUser]Component "
+ + componentString + " as an Activity or a Service");
}
/**
* @returns true if the componentName led to an Activity that was started.
*/
- private boolean startConfirmationActivity(ComponentName componentName, String key,
- String fingerprints) {
+ private boolean startConfirmationActivity(ComponentName componentName, UserHandle userHandle,
+ String key, String fingerprints) {
PackageManager packageManager = mContext.getPackageManager();
Intent intent = createConfirmationIntent(componentName, key, fingerprints);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
try {
- mContext.startActivityAsUser(intent, UserHandle.OWNER);
+ mContext.startActivityAsUser(intent, userHandle);
return true;
} catch (ActivityNotFoundException e) {
Slog.e(TAG, "unable to start adb whitelist activity: " + componentName, e);
@@ -352,11 +365,11 @@
/**
* @returns true if the componentName led to a Service that was started.
*/
- private boolean startConfirmationService(ComponentName componentName, String key,
- String fingerprints) {
+ private boolean startConfirmationService(ComponentName componentName, UserHandle userHandle,
+ String key, String fingerprints) {
Intent intent = createConfirmationIntent(componentName, key, fingerprints);
try {
- if (mContext.startService(intent) != null) {
+ if (mContext.startServiceAsUser(intent, userHandle) != null) {
return true;
}
} catch (SecurityException e) {
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index cb8f938..d6a7dd1 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -411,6 +411,16 @@
sendMessageDelayed(msg, (connected == 0) ? UPDATE_DELAY : 0);
}
+ private void updatePersistentProperty() {
+ String newValue = mAdbEnabled ? "adb" : "none";
+ String value = SystemProperties.get(UsbManager.ADB_PERSISTENT_PROPERTY);
+ if (DEBUG) { Slog.d(TAG, "updatePersistentProperty newValue=" + newValue + " value=" + value); }
+ if (!newValue.equals(value)) {
+ SystemProperties.set(UsbManager.ADB_PERSISTENT_PROPERTY, mAdbEnabled ? "adb" : "none");
+ }
+ waitForState(newValue);
+ }
+
private boolean waitForState(String state) {
// wait for the transition to complete.
// give up after 1 second.
@@ -426,7 +436,10 @@
private boolean setUsbConfig(String config) {
if (DEBUG) Slog.d(TAG, "setUsbConfig(" + config + ")");
// set the new configuration
- SystemProperties.set(UsbManager.USB_SETTINGS_PROPERTY, config);
+ String oldConfig = SystemProperties.get(UsbManager.USB_SETTINGS_PROPERTY);
+ if (!config.equals(oldConfig)) {
+ SystemProperties.set(UsbManager.USB_SETTINGS_PROPERTY, config);
+ }
return waitForState(config);
}
@@ -436,7 +449,7 @@
mAdbEnabled = enable;
// Due to the persist.sys.usb.config property trigger, changing adb state requires
// persisting default function
- SystemProperties.set(UsbManager.ADB_PERSISTENT_PROPERTY, mAdbEnabled ? "adb" : "none");
+ updatePersistentProperty();
// After persisting them use the lock-down aware function set
setEnabledFunctions(getDefaultFunctions());
updateAdbNotification();
@@ -610,7 +623,7 @@
break;
case MSG_SYSTEM_READY:
setUsbConfig(mCurrentFunctions);
- SystemProperties.set(UsbManager.ADB_PERSISTENT_PROPERTY, mAdbEnabled ? "adb" : "none");
+ updatePersistentProperty();
updateUsbNotification();
updateAdbNotification();
updateUsbState();
diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java
index b18feb5..77fdb65 100644
--- a/telecomm/java/android/telecom/Conference.java
+++ b/telecomm/java/android/telecom/Conference.java
@@ -206,7 +206,7 @@
* Returns video state of the primary call.
*/
public int getVideoState() {
- return VideoProfile.VideoState.AUDIO_ONLY;
+ return VideoProfile.STATE_AUDIO_ONLY;
}
/**
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index e2bbc62..bb210f1 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -1608,7 +1608,7 @@
* a request to accept.
*/
public void onAnswer() {
- onAnswer(VideoProfile.VideoState.AUDIO_ONLY);
+ onAnswer(VideoProfile.STATE_AUDIO_ONLY);
}
/**
diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java
index 975df5d..6863214 100644
--- a/telecomm/java/android/telecom/ConnectionRequest.java
+++ b/telecomm/java/android/telecom/ConnectionRequest.java
@@ -42,7 +42,7 @@
PhoneAccountHandle accountHandle,
Uri handle,
Bundle extras) {
- this(accountHandle, handle, extras, VideoProfile.VideoState.AUDIO_ONLY);
+ this(accountHandle, handle, extras, VideoProfile.STATE_AUDIO_ONLY);
}
/**
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
index 1cb042c..4ab9ee5 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
@@ -342,10 +342,10 @@
/**
* Sets the video state associated with a call.
*
- * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY},
- * {@link VideoProfile.VideoState#BIDIRECTIONAL},
- * {@link VideoProfile.VideoState#TX_ENABLED},
- * {@link VideoProfile.VideoState#RX_ENABLED}.
+ * Valid values: {@link VideoProfile#STATE_BIDIRECTIONAL},
+ * {@link VideoProfile#STATE_AUDIO_ONLY},
+ * {@link VideoProfile#STATE_TX_ENABLED},
+ * {@link VideoProfile#STATE_RX_ENABLED}.
*
* @param callId The unique ID of the call to set the video state for.
* @param videoState The video state.
diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java
index d3df151..3d49308 100644
--- a/telecomm/java/android/telecom/DefaultDialerManager.java
+++ b/telecomm/java/android/telecom/DefaultDialerManager.java
@@ -41,10 +41,13 @@
* The caller of this method needs to have permission to write to secure settings and
* manage users on the device.
*
+ * @return {@code true} if the default dialer application was successfully changed,
+ * {@code false} otherwise.
+ *
* @hide
* */
- public static void setDefaultDialerApplication(Context context, String packageName) {
- setDefaultDialerApplication(context, packageName, ActivityManager.getCurrentUser());
+ public static boolean setDefaultDialerApplication(Context context, String packageName) {
+ return setDefaultDialerApplication(context, packageName, ActivityManager.getCurrentUser());
}
/**
@@ -52,16 +55,20 @@
* The caller of this method needs to have permission to write to secure settings and
* manage users on the device.
*
+ * @return {@code true} if the default dialer application was successfully changed,
+ * {@code false} otherwise.
+ *
* @hide
* */
- public static void setDefaultDialerApplication(Context context, String packageName, int user) {
+ public static boolean setDefaultDialerApplication(Context context, String packageName,
+ int user) {
// Get old package name
String oldPackageName = Settings.Secure.getStringForUser(context.getContentResolver(),
Settings.Secure.DIALER_DEFAULT_APPLICATION, user);
if (packageName != null && oldPackageName != null && packageName.equals(oldPackageName)) {
// No change
- return;
+ return false;
}
// Only make the change if the new package belongs to a valid phone application
@@ -71,7 +78,9 @@
// Update the secure setting.
Settings.Secure.putStringForUser(context.getContentResolver(),
Settings.Secure.DIALER_DEFAULT_APPLICATION, packageName, user);
+ return true;
}
+ return false;
}
/**
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index 52c60e6..d62c08e 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -605,7 +605,7 @@
/**
* Obtains the video state of this {@code RemoteConnection}.
*
- * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile.VideoState}.
+ * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile}.
*/
public int getVideoState() {
return mVideoState;
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 07176b3..3c8cc9aa 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -124,33 +124,6 @@
"android.telecom.action.CHANGE_DEFAULT_DIALER";
/**
- * Privileged version of {@link #ACTION_CHANGE_DEFAULT_DIALER} that doesn't require
- * confirmation from the user via the dialog.
- *
- * Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE}
- * @hide
- */
- public static final String ACTION_CHANGE_DEFAULT_DIALER_PRIVILEGED =
- "android.telecom.action.CHANGE_DEFAULT_DIALER_PRIVILEGED";
-
- /**
- * Activity action: Opens the settings screen where a user can enable and disable which
- * {@link PhoneAccount}s are allows to make and receive calls. Because a user must
- * explicitly enable an account before the system will use it, an app may want to send the
- * user to this setting after registering a {@link PhoneAccount}.
- * <p>
- * Input: get*Extra field {@link #EXTRA_PHONE_ACCOUNT_DESCRIPTION} contains a string-based
- * reference to the {@link PhoneAccountHandle} you want to enable. get*Extra field
- * {@link #EXTRA_ENABLE_PHONE_ACCOUNT_VALUE} contains a boolean value indicated whether
- * the account should be enabled or disabled.
- * <p>
- * Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE}
- * @hide
- */
- public static final String ACTION_ENABLE_PHONE_ACCOUNT_SETTING =
- "android.telecom.action.ENABLE_PHONE_ACCOUNT_SETTING";
-
- /**
* Extra value used to provide the package name for {@link #ACTION_CHANGE_DEFAULT_DIALER}.
*/
public static final String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME =
@@ -186,25 +159,6 @@
"android.telecom.extra.PHONE_ACCOUNT_HANDLE";
/**
- * The extra used with {@link #ACTION_ENABLE_PHONE_ACCOUNT_SETTING} to specify a phone account
- * as a string value. The value is of the form: "A;B" where A is the component name of the
- * {@link PhoneAccount} (e.g.,
- * com.android.phone/com.android.services.telephony.TelephonyConnectionService) and B is the
- * {@link PhoneAccount} ID.
- * @hide
- */
- public static final String EXTRA_PHONE_ACCOUNT_DESCRIPTION =
- "android.telecom.extra.PHONE_ACCOUNT_DESCRIPTION";
-
- /**
- * Boolean extra used to specify a value for enabling and disabling a phone account.
- * Used with {@link #ACTION_ENABLE_PHONE_ACCOUNT_SETTING}.
- * @hide
- */
- public static final String EXTRA_ENABLE_PHONE_ACCOUNT_VALUE =
- "android.telecom.extra.ENABLE_PHONE_ACCOUNT_VALUE";
-
- /**
* Optional extra for {@link #ACTION_INCOMING_CALL} containing a {@link Bundle} which contains
* metadata about the call. This {@link Bundle} will be returned to the
* {@link ConnectionService}.
diff --git a/telecomm/java/android/telecom/VideoProfile.java b/telecomm/java/android/telecom/VideoProfile.java
index 71de505..11a49767 100644
--- a/telecomm/java/android/telecom/VideoProfile.java
+++ b/telecomm/java/android/telecom/VideoProfile.java
@@ -173,7 +173,7 @@
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[VideoProfile videoState = ");
- sb.append(VideoState.videoStateToString(mVideoState));
+ sb.append(videoStateToString(mVideoState));
sb.append(" videoQuality = ");
sb.append(mQuality);
sb.append("]");
@@ -181,142 +181,106 @@
}
/**
- * The video state of the call, stored as a bit-field describing whether video transmission and
- * receipt it enabled, as well as whether the video is currently muted.
- */
- public static class VideoState {
- /**
- * Call is currently in an audio-only mode with no video transmission or receipt.
- * @deprecated Use {@link VideoProfile#STATE_AUDIO_ONLY} instead
- * @hide
- */
- public static final int AUDIO_ONLY = VideoProfile.STATE_AUDIO_ONLY;
+ * Generates a string representation of a video state.
+ *
+ * @param videoState The video state.
+ * @return String representation of the video state.
+ */
+ public static String videoStateToString(int videoState) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Audio");
- /**
- * Video transmission is enabled.
- * @deprecated Use {@link VideoProfile#STATE_TX_ENABLED} instead
- * @hide
- */
- public static final int TX_ENABLED = VideoProfile.STATE_TX_ENABLED;
-
- /**
- * Video reception is enabled.
- * @deprecated Use {@link VideoProfile#STATE_RX_ENABLED} instead
- * @hide
- */
- public static final int RX_ENABLED = VideoProfile.STATE_RX_ENABLED;
-
- /**
- * Video signal is bi-directional.
- * @deprecated Use {@link VideoProfile#STATE_BIDIRECTIONAL} instead
- * @hide
- */
- public static final int BIDIRECTIONAL = VideoProfile.STATE_BIDIRECTIONAL;
-
- /**
- * Video is paused.
- * @deprecated Use {@link VideoProfile#STATE_PAUSED} instead
- * @hide
- */
- public static final int PAUSED = VideoProfile.STATE_PAUSED;
-
- /** @hide */
- private VideoState() {}
-
- /**
- * Whether the video state is audio only.
- * @param videoState The video state.
- * @return Returns true if the video state is audio only.
- */
- public static boolean isAudioOnly(int videoState) {
- return !hasState(videoState, VideoProfile.STATE_TX_ENABLED)
- && !hasState(videoState, VideoProfile.STATE_RX_ENABLED);
- }
-
- /**
- * Whether the video state is any of the video type
- * @param videoState The video state.
- * @hide
- * @return Returns true if the video state TX or RX or Bidirectional
- */
- public static boolean isVideo(int videoState) {
- return hasState(videoState, VideoProfile.STATE_TX_ENABLED)
- || hasState(videoState, VideoProfile.STATE_RX_ENABLED)
- || hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
- }
-
- /**
- * Whether the video transmission is enabled.
- * @param videoState The video state.
- * @return Returns true if the video transmission is enabled.
- */
- public static boolean isTransmissionEnabled(int videoState) {
- return hasState(videoState, VideoProfile.STATE_TX_ENABLED);
- }
-
- /**
- * Whether the video reception is enabled.
- * @param videoState The video state.
- * @return Returns true if the video transmission is enabled.
- */
- public static boolean isReceptionEnabled(int videoState) {
- return hasState(videoState, VideoProfile.STATE_RX_ENABLED);
- }
-
- /**
- * Whether the video signal is bi-directional.
- * @param videoState
- * @return Returns true if the video signal is bi-directional.
- */
- public static boolean isBidirectional(int videoState) {
- return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
- }
-
- /**
- * Whether the video is paused.
- * @param videoState The video state.
- * @return Returns true if the video is paused.
- */
- public static boolean isPaused(int videoState) {
- return hasState(videoState, VideoProfile.STATE_PAUSED);
- }
-
- /**
- * Determines if a specified state is set in a videoState bit-mask.
- *
- * @param videoState The video state bit-mask.
- * @param state The state to check.
- * @return {@code True} if the state is set.
- * {@hide}
- */
- private static boolean hasState(int videoState, int state) {
- return (videoState & state) == state;
- }
-
- /**
- * Generates a string representation of a {@link VideoState}.
- *
- * @param videoState The video state.
- * @return String representation of the {@link VideoState}.
- */
- public static String videoStateToString(int videoState) {
- StringBuilder sb = new StringBuilder();
- sb.append("Audio");
-
- if (VideoProfile.VideoState.isTransmissionEnabled(videoState)) {
+ if (isAudioOnly(videoState)) {
+ sb.append(" Only");
+ } else {
+ if (isTransmissionEnabled(videoState)) {
sb.append(" Tx");
}
- if (VideoProfile.VideoState.isReceptionEnabled(videoState)) {
+ if (isReceptionEnabled(videoState)) {
sb.append(" Rx");
}
- if (VideoProfile.VideoState.isPaused(videoState)) {
+ if (isPaused(videoState)) {
sb.append(" Pause");
}
-
- return sb.toString();
}
+
+ return sb.toString();
+ }
+
+ /**
+ * Indicates whether the video state is audio only.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if the video state is audio only, {@code false} otherwise.
+ */
+ public static boolean isAudioOnly(int videoState) {
+ return !hasState(videoState, VideoProfile.STATE_TX_ENABLED)
+ && !hasState(videoState, VideoProfile.STATE_RX_ENABLED);
+ }
+
+ /**
+ * Indicates whether video transmission or reception is enabled for a video state.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if video transmission or reception is enabled, {@code false} otherwise.
+ */
+ public static boolean isVideo(int videoState) {
+ return hasState(videoState, VideoProfile.STATE_TX_ENABLED)
+ || hasState(videoState, VideoProfile.STATE_RX_ENABLED)
+ || hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
+ }
+
+ /**
+ * Indicates whether the video state has video transmission enabled.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if video transmission is enabled, {@code false} otherwise.
+ */
+ public static boolean isTransmissionEnabled(int videoState) {
+ return hasState(videoState, VideoProfile.STATE_TX_ENABLED);
+ }
+
+ /**
+ * Indicates whether the video state has video reception enabled.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if video reception is enabled, {@code false} otherwise.
+ */
+ public static boolean isReceptionEnabled(int videoState) {
+ return hasState(videoState, VideoProfile.STATE_RX_ENABLED);
+ }
+
+ /**
+ * Indicates whether the video state is bi-directional.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if the video is bi-directional, {@code false} otherwise.
+ */
+ public static boolean isBidirectional(int videoState) {
+ return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
+ }
+
+ /**
+ * Indicates whether the video state is paused.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if the video is paused, {@code false} otherwise.
+ */
+ public static boolean isPaused(int videoState) {
+ return hasState(videoState, VideoProfile.STATE_PAUSED);
+ }
+
+ /**
+ * Indicates if a specified state is set in a videoState bit-mask.
+ *
+ * @param videoState The video state bit-mask.
+ * @param state The state to check.
+ * @return {@code True} if the state is set.
+ */
+ private static boolean hasState(int videoState, int state) {
+ return (videoState & state) == state;
}
/**
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index aa02021..ea6a74a 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -231,5 +231,10 @@
/**
* @see TelecomServiceImpl#enablePhoneAccount
*/
- void enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled);
+ boolean enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled);
+
+ /**
+ * @see TelecomServiceImpl#setDefaultDialer
+ */
+ boolean setDefaultDialer(in String packageName);
}
diff --git a/telephony/java/com/android/ims/ImsCallProfile.java b/telephony/java/com/android/ims/ImsCallProfile.java
index 604d32d..1c69794 100644
--- a/telephony/java/com/android/ims/ImsCallProfile.java
+++ b/telephony/java/com/android/ims/ImsCallProfile.java
@@ -313,28 +313,28 @@
* @return The video state.
*/
public static int getVideoStateFromImsCallProfile(ImsCallProfile callProfile) {
- int videostate = VideoProfile.VideoState.AUDIO_ONLY;
+ int videostate = VideoProfile.STATE_AUDIO_ONLY;
switch (callProfile.mCallType) {
case CALL_TYPE_VT_TX:
- videostate = VideoProfile.VideoState.TX_ENABLED;
+ videostate = VideoProfile.STATE_TX_ENABLED;
break;
case CALL_TYPE_VT_RX:
- videostate = VideoProfile.VideoState.RX_ENABLED;
+ videostate = VideoProfile.STATE_RX_ENABLED;
break;
case CALL_TYPE_VT:
- videostate = VideoProfile.VideoState.BIDIRECTIONAL;
+ videostate = VideoProfile.STATE_BIDIRECTIONAL;
break;
case CALL_TYPE_VOICE:
- videostate = VideoProfile.VideoState.AUDIO_ONLY;
+ videostate = VideoProfile.STATE_AUDIO_ONLY;
break;
default:
- videostate = VideoProfile.VideoState.AUDIO_ONLY;
+ videostate = VideoProfile.STATE_AUDIO_ONLY;
break;
}
- if (callProfile.isVideoPaused() && videostate != VideoProfile.VideoState.AUDIO_ONLY) {
- videostate |= VideoProfile.VideoState.PAUSED;
+ if (callProfile.isVideoPaused() && videostate != VideoProfile.STATE_AUDIO_ONLY) {
+ videostate |= VideoProfile.STATE_PAUSED;
} else {
- videostate &= ~VideoProfile.VideoState.PAUSED;
+ videostate &= ~VideoProfile.STATE_PAUSED;
}
return videostate;
}
@@ -347,9 +347,9 @@
* @return The call type.
*/
public static int getCallTypeFromVideoState(int videoState) {
- boolean videoTx = isVideoStateSet(videoState, VideoProfile.VideoState.TX_ENABLED);
- boolean videoRx = isVideoStateSet(videoState, VideoProfile.VideoState.RX_ENABLED);
- boolean isPaused = isVideoStateSet(videoState, VideoProfile.VideoState.PAUSED);
+ boolean videoTx = isVideoStateSet(videoState, VideoProfile.STATE_TX_ENABLED);
+ boolean videoRx = isVideoStateSet(videoState, VideoProfile.STATE_RX_ENABLED);
+ boolean isPaused = isVideoStateSet(videoState, VideoProfile.STATE_PAUSED);
if (isPaused) {
return ImsCallProfile.CALL_TYPE_VT_NODIR;
} else if (videoTx && !videoRx) {