Merge "QS: Share usage tracking timeout with color inversion tile." into lmp-dev
diff --git a/core/java/android/hardware/hdmi/HdmiClient.java b/core/java/android/hardware/hdmi/HdmiClient.java
index c43e21a..5d26a57 100644
--- a/core/java/android/hardware/hdmi/HdmiClient.java
+++ b/core/java/android/hardware/hdmi/HdmiClient.java
@@ -1,5 +1,6 @@
package android.hardware.hdmi;
+import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.hardware.hdmi.HdmiControlManager.VendorCommandListener;
import android.hardware.hdmi.IHdmiVendorCommandListener;
@@ -25,6 +26,21 @@
}
/**
+ * Returns the active source information.
+ *
+ * @return {@link HdmiCecDeviceInfo} object that describes the active source
+ * or active routing path
+ */
+ public HdmiCecDeviceInfo getActiveSource() {
+ try {
+ return mService.getActiveSource();
+ } catch (RemoteException e) {
+ Log.e(TAG, "getActiveSource threw exception ", e);
+ }
+ return null;
+ }
+
+ /**
* Send a key event to other logical device.
*
* @param keyCode key code to send. Defined in {@link android.view.KeyEvent}.
@@ -60,7 +76,10 @@
*
* @param listener listener object
*/
- public void addVendorCommandListener(VendorCommandListener listener) {
+ public void addVendorCommandListener(@NonNull VendorCommandListener listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException("listener cannot be null");
+ }
try {
mService.addVendorCommandListener(getListenerWrapper(listener), getDeviceType());
} catch (RemoteException e) {
diff --git a/core/java/android/hardware/hdmi/HdmiControlManager.java b/core/java/android/hardware/hdmi/HdmiControlManager.java
index a4a3ac3..e7bd3e4 100644
--- a/core/java/android/hardware/hdmi/HdmiControlManager.java
+++ b/core/java/android/hardware/hdmi/HdmiControlManager.java
@@ -245,7 +245,30 @@
}
/**
- * Gets an object that represents a HDMI-CEC logical device of type playback on the system.
+ * Gets an object that represents an HDMI-CEC logical device of a specified type.
+ *
+ * @param type CEC device type
+ * @return {@link HdmiClient} instance. {@code null} on failure.
+ * @see {@link HdmiCecDeviceInfo#DEVICE_PLAYBACK}
+ * @see {@link HdmiCecDeviceInfo#DEVICE_TV}
+ */
+ @Nullable
+ public HdmiClient getClient(int type) {
+ if (mService == null) {
+ return null;
+ }
+ switch (type) {
+ case HdmiCecDeviceInfo.DEVICE_TV:
+ return mHasTvDevice ? new HdmiTvClient(mService) : null;
+ case HdmiCecDeviceInfo.DEVICE_PLAYBACK:
+ return mHasPlaybackDevice ? new HdmiPlaybackClient(mService) : null;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Gets an object that represents an HDMI-CEC logical device of type playback on the system.
*
* <p>Used to send HDMI control messages to other devices like TV or audio amplifier through
* HDMI bus. It is also possible to communicate with other logical devices hosted in the same
@@ -255,14 +278,11 @@
*/
@Nullable
public HdmiPlaybackClient getPlaybackClient() {
- if (mService == null || !mHasPlaybackDevice) {
- return null;
- }
- return new HdmiPlaybackClient(mService);
+ return (HdmiPlaybackClient) getClient(HdmiCecDeviceInfo.DEVICE_PLAYBACK);
}
/**
- * Gets an object that represents a HDMI-CEC logical device of type TV on the system.
+ * Gets an object that represents an HDMI-CEC logical device of type TV on the system.
*
* <p>Used to send HDMI control messages to other devices and manage them through
* HDMI bus. It is also possible to communicate with other logical devices hosted in the same
@@ -272,10 +292,7 @@
*/
@Nullable
public HdmiTvClient getTvClient() {
- if (mService == null || !mHasTvDevice) {
- return null;
- }
- return new HdmiTvClient(mService);
+ return (HdmiTvClient) getClient(HdmiCecDeviceInfo.DEVICE_TV);
}
/**
diff --git a/core/java/android/hardware/hdmi/HdmiRecordListener.java b/core/java/android/hardware/hdmi/HdmiRecordListener.java
index fe44bd9..105a8ca 100644
--- a/core/java/android/hardware/hdmi/HdmiRecordListener.java
+++ b/core/java/android/hardware/hdmi/HdmiRecordListener.java
@@ -147,8 +147,8 @@
* <li>{@link HdmiControlManager#TIMER_STATUS_PROGRAMMED_INFO_NO_MEDIA_INFO}
* </ul>
*
- * @throw {@link IllegalStateException} if it's called when {@link #isProgrammed()}
- * returns false
+ * @throws IllegalStateException if it's called when {@link #isProgrammed()}
+ * returns false
*/
public int getProgrammedInfo() {
if (!isProgrammed()) {
@@ -175,8 +175,8 @@
* <li>{@link HdmiControlManager#TIMER_STATUS_NOT_PROGRAMMED_DUPLICATED}
* </ul>
*
- * @throw {@link IllegalStateException} if it's called when {@link #isProgrammed()}
- * returns true
+ * @throws IllegalStateException if it's called when {@link #isProgrammed()}
+ * returns true
*/
public int getNotProgammedError() {
if (isProgrammed()) {
diff --git a/core/java/android/hardware/hdmi/HdmiRecordSources.java b/core/java/android/hardware/hdmi/HdmiRecordSources.java
index 917d1d9..dcc41fa 100644
--- a/core/java/android/hardware/hdmi/HdmiRecordSources.java
+++ b/core/java/android/hardware/hdmi/HdmiRecordSources.java
@@ -71,7 +71,7 @@
return includeType ? mExtraDataSize + 1 : mExtraDataSize;
}
- public final int toByteArray(boolean includeType, byte[] data, int index) {
+ final int toByteArray(boolean includeType, byte[] data, int index) {
if (includeType) {
// 1 to 8 bytes (depends on source).
// {[Record Source Type]} |
@@ -161,7 +161,7 @@
* Interface for digital source identification.
*/
private interface DigitalServiceIdentification {
- void toByteArray(byte[] data, int index);
+ int toByteArray(byte[] data, int index);
}
/**
@@ -193,8 +193,9 @@
}
@Override
- public void toByteArray(byte[] data, int index) {
- threeFieldsToSixBytes(mTransportStreamId, mServiceId, mOriginalNetworkId, data, index);
+ public int toByteArray(byte[] data, int index) {
+ return threeFieldsToSixBytes(mTransportStreamId, mServiceId, mOriginalNetworkId, data,
+ index);
}
}
@@ -221,8 +222,8 @@
}
@Override
- public void toByteArray(byte[] data, int index) {
- threeFieldsToSixBytes(mTransportStreamId, mProgramNumber, 0, data, index);
+ public int toByteArray(byte[] data, int index) {
+ return threeFieldsToSixBytes(mTransportStreamId, mProgramNumber, 0, data, index);
}
}
@@ -255,8 +256,9 @@
}
@Override
- public void toByteArray(byte[] data, int index) {
- threeFieldsToSixBytes(mTransportStreamId, mServiceId, mOriginalNetworkId, data, index);
+ public int toByteArray(byte[] data, int index) {
+ return threeFieldsToSixBytes(mTransportStreamId, mServiceId, mOriginalNetworkId, data,
+ index);
}
}
@@ -283,12 +285,13 @@
mMinorChannelNumber = minorNumer;
}
- private void toByteArray(byte[] data, int index) {
+ private int toByteArray(byte[] data, int index) {
// The first 6 bits for format, the 10 bits for major number.
data[index] = (byte) (((mChannelNumberFormat << 2) | (mMajorChannelNumber >>> 8) & 0x3));
data[index + 1] = (byte) (mMajorChannelNumber & 0xFF);
// Minor number uses the next 16 bits.
shortToByteArray((short) mMinorChannelNumber, data, index + 2);
+ return 4;
}
}
@@ -323,11 +326,12 @@
}
@Override
- public void toByteArray(byte[] data, int index) {
+ public int toByteArray(byte[] data, int index) {
mChannelIdentifier.toByteArray(data, index);
// The last 2 bytes is reserved for future use.
data[index + 4] = 0;
data[index + 5] = 0;
+ return 6;
}
}
diff --git a/core/java/android/hardware/hdmi/HdmiTimerRecordSources.java b/core/java/android/hardware/hdmi/HdmiTimerRecordSources.java
index db2d6d8..1780707 100644
--- a/core/java/android/hardware/hdmi/HdmiTimerRecordSources.java
+++ b/core/java/android/hardware/hdmi/HdmiTimerRecordSources.java
@@ -210,7 +210,7 @@
* @hide
*/
@SystemApi
- public static class Time extends TimeUnit {
+ public static final class Time extends TimeUnit {
private Time(int hour, int minute) {
super(hour, minute);
}
@@ -221,7 +221,7 @@
* @hide
*/
@SystemApi
- public static class Duration extends TimeUnit {
+ public static final class Duration extends TimeUnit {
private Duration(int hour, int minute) {
super(hour, minute);
}
@@ -298,7 +298,7 @@
* @hide
*/
@SystemApi
- public static class TimerInfo {
+ public static final class TimerInfo {
private static final int DAY_OF_MONTH_SIZE = 1;
private static final int MONTH_OF_YEAR_SIZE = 1;
private static final int START_TIME_SIZE = 2; // 1byte for hour and 1byte for minute.
@@ -373,7 +373,7 @@
* @hide
*/
@SystemApi
- public static class TimerRecordSource {
+ public static final class TimerRecordSource {
private final RecordSource mRecordSource;
private final TimerInfo mTimerInfo;
diff --git a/core/java/android/hardware/hdmi/HdmiTvClient.java b/core/java/android/hardware/hdmi/HdmiTvClient.java
index 2735108..077a17e 100644
--- a/core/java/android/hardware/hdmi/HdmiTvClient.java
+++ b/core/java/android/hardware/hdmi/HdmiTvClient.java
@@ -114,15 +114,14 @@
/**
* Select a CEC logical device to be a new active source.
*
- * @param logicalAddress
- * @param callback
+ * @param logicalAddress logical address of the device to select
+ * @param callback callback to get the result with
+ * @throws {@link IllegalArgumentException} if the {@code callback} is null
*/
public void deviceSelect(int logicalAddress, @NonNull SelectCallback callback) {
if (callback == null) {
throw new IllegalArgumentException("callback must not be null.");
}
-
- // TODO: Replace SelectCallback with PartialResult.
try {
mService.deviceSelect(logicalAddress, getCallbackWrapper(callback));
} catch (RemoteException e) {
@@ -131,6 +130,24 @@
}
/**
+ * Select a HDMI port to be a new route path.
+ *
+ * @param portId HDMI port to select
+ * @param callback callback to get the result with
+ * @throws {@link IllegalArgumentException} if the {@code callback} is null
+ */
+ public void portSelect(int portId, @NonNull SelectCallback callback) {
+ if (callback == null) {
+ throw new IllegalArgumentException("Callback must not be null");
+ }
+ try {
+ mService.portSelect(portId, getCallbackWrapper(callback));
+ } catch (RemoteException e) {
+ Log.e(TAG, "failed to select port: ", e);
+ }
+ }
+
+ /**
* Set system audio volume
*
* @param oldIndex current volume index
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 3f6cd95..e94a046 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4846,10 +4846,106 @@
<!-- Lock-to-app unlock password string -->
<string name="lock_to_app_unlock_password">password</string>
+ <!-- TV content rating system strings for AM TV -->
+
+ <!-- TV content rating system strings for AR TV -->
+
+ <!-- TV content rating system strings for AU TV -->
+
+ <!-- TV content rating system strings for BG TV -->
+
+ <!-- TV content rating system strings for BR TV -->
+
+ <!-- TV content rating system strings for CA TV -->
+
+ <!-- TV content rating system strings for CH TV -->
+
+ <!-- TV content rating system strings for CL TV -->
+
+ <!-- TV content rating system strings for CO TV -->
+
+ <!-- TV content rating system strings for DE TV -->
+
+ <!-- TV content rating system strings for DK TV -->
+
+ <!-- TV content rating system strings for ES TV -->
+
+ <!-- TV content rating system strings for FI TV -->
+
+ <!-- TV content rating system strings for FR TV -->
+
+ <!-- TV content rating system strings for GR TV -->
+
+ <!-- TV content rating system strings for HK TV -->
+
+ <!-- TV content rating system strings for HU TV -->
+
+ <!-- TV content rating system strings for ID TV -->
+
+ <!-- TV content rating system strings for IE TV -->
+
+ <!-- TV content rating system strings for IL TV -->
+
+ <!-- TV content rating system strings for IN TV -->
+
+ <!-- TV content rating system strings for IS TV -->
+
+ <!-- TV content rating system strings for IT TV -->
+
+ <!-- TV content rating system strings for KH TV -->
+
+ <!-- TV content rating system strings for KR TV -->
+ <string name="display_name_krtv" translatable="false">KR-TV</string>
+ <string name="display_name_krtv_all" translatable="false">모든연령시청가</string>
+ <string name="display_name_krtv_7" translatable="false">7세이상시청가</string>
+ <string name="display_name_krtv_12" translatable="false">12세이상시청가</string>
+ <string name="display_name_krtv_15" translatable="false">15세이상시청가</string>
+ <string name="display_name_krtv_19" translatable="false">19세이상시청가</string>
+ <string name="description_krtv_all">모든 연령의 시청자가 시청하기에 부적절한 내용이 없는 등급을 말한다.</string>
+ <string name="description_krtv_7">7세미만의 어린이가 시청하기에 부적절한 내용이 포함되어 있어 보호자의 시청지도가 필요한 등급을 말한다.</string>
+ <string name="description_krtv_12">12세미만의 청소년이 시청하기에 부적절한 내용이 포함되어 있어 보호자의 시청지도가 필요한 등급을 말한다.</string>
+ <string name="description_krtv_15">15세미만의 청소년이 시청하기에 부적절한 내용이 포함되어 있어 보호자의 시청지도가 필요한 등급을 말한다.</string>
+ <string name="description_krtv_19">19세미만의 청소년이 시청하기에 부적절한 내용이 포함되어 있어 청소년이 시청할 수 없는 등급을 말한다.</string>
+
+ <!-- TV content rating system strings for MV TV -->
+
+ <!-- TV content rating system strings for MX TV -->
+
+ <!-- TV content rating system strings for MY TV -->
+
+ <!-- TV content rating system strings for NL TV -->
+
+ <!-- TV content rating system strings for NZ TV -->
+
+ <!-- TV content rating system strings for PE TV -->
+
+ <!-- TV content rating system strings for PH TV -->
+
+ <!-- TV content rating system strings for PL TV -->
+
+ <!-- TV content rating system strings for PT TV -->
+
+ <!-- TV content rating system strings for RO TV -->
+
+ <!-- TV content rating system strings for RU TV -->
+
+ <!-- TV content rating system strings for RS TV -->
+
+ <!-- TV content rating system strings for SG TV -->
+
+ <!-- TV content rating system strings for SI TV -->
+
+ <!-- TV content rating system strings for TH TV -->
+
+ <!-- TV content rating system strings for TR TV -->
+
+ <!-- TV content rating system strings for TW TV -->
+
+ <!-- TV content rating system strings for UA TV -->
+
+ <!-- TV content rating system strings for US TV -->
<string name="display_name_ustvpg" translatable="false">US-TV</string>
<string name="description_ustvpg">The TV Parental Guidelines</string>
- <string name="display_name_krtv" translatable="false">KR-TV</string>
-
<string name="display_name_ustvpg_d" translatable="false">D</string>
<string name="display_name_ustvpg_l" translatable="false">L</string>
<string name="display_name_ustvpg_s" translatable="false">S</string>
@@ -4861,12 +4957,6 @@
<string name="display_name_ustvpg_pg" translatable="false">TV-PG</string>
<string name="display_name_ustvpg_14" translatable="false">TV-14</string>
<string name="display_name_ustvpg_ma" translatable="false">TV-MA</string>
- <string name="display_name_krtv_all" translatable="false">모든연령시청가</string>
- <string name="display_name_krtv_7" translatable="false">7세이상시청가</string>
- <string name="display_name_krtv_12" translatable="false">12세이상시청가</string>
- <string name="display_name_krtv_15" translatable="false">15세이상시청가</string>
- <string name="display_name_krtv_19" translatable="false">19세이상시청가</string>
-
<string name="description_ustvpg_d">Suggestive dialogue (Usually means talks about sex)</string>
<string name="description_ustvpg_l">Coarse language</string>
<string name="description_ustvpg_s">Sexual content</string>
@@ -4878,12 +4968,11 @@
<string name="description_ustvpg_pg">This program contains material that parents may find unsuitable for younger children.</string>
<string name="description_ustvpg_14">This program contains some material that many parents would find unsuitable for children under 14 years of age.</string>
<string name="description_ustvpg_ma">This program is specifically designed to be viewed by adults and therefore may be unsuitable for children under 17.</string>
- <string name="description_krtv_all">모든 연령의 시청자가 시청하기에 부적절한 내용이 없는 등급을 말한다.</string>
- <string name="description_krtv_7">7세미만의 어린이가 시청하기에 부적절한 내용이 포함되어 있어 보호자의 시청지도가 필요한 등급을 말한다.</string>
- <string name="description_krtv_12">12세미만의 청소년이 시청하기에 부적절한 내용이 포함되어 있어 보호자의 시청지도가 필요한 등급을 말한다.</string>
- <string name="description_krtv_15">15세미만의 청소년이 시청하기에 부적절한 내용이 포함되어 있어 보호자의 시청지도가 필요한 등급을 말한다.</string>
- <string name="description_krtv_19">19세미만의 청소년이 시청하기에 부적절한 내용이 포함되어 있어 청소년이 시청할 수 없는 등급을 말한다.</string>
- <!-- [CHAR_LIMIT=NONE] Battery saver: Feature description -->
+ <!-- TV content rating system strings for VE TV -->
+
+ <!-- TV content rating system strings for ZA TV -->
+
+ <!-- [CHAR_LIMIT=NONE] Battery saver: Feature description -->
<string name="battery_saver_description">To help improve battery life, battery saver will reduce your device’s performance and restrict background data. Email, messaging, and other apps that rely on syncing may not update unless you open them.\n\nBattery saver turns off automatically when your device is charging.</string>
</resources>
diff --git a/core/res/res/xml/tv_content_rating_systems.xml b/core/res/res/xml/tv_content_rating_systems.xml
index bd9abb8..57fd2ad 100644
--- a/core/res/res/xml/tv_content_rating_systems.xml
+++ b/core/res/res/xml/tv_content_rating_systems.xml
@@ -17,6 +17,124 @@
*/
-->
<rating-system-definitions>
+ <!-- TV content rating system for AM TV -->
+
+ <!-- TV content rating system for AR TV -->
+
+ <!-- TV content rating system for AU TV -->
+
+ <!-- TV content rating system for BG TV -->
+
+ <!-- TV content rating system for BR TV -->
+
+ <!-- TV content rating system for CA TV -->
+
+ <!-- TV content rating system for CH TV -->
+
+ <!-- TV content rating system for CL TV -->
+
+ <!-- TV content rating system for CO TV -->
+
+ <!-- TV content rating system for DE TV -->
+
+ <!-- TV content rating system for DK TV -->
+
+ <!-- TV content rating system for ES TV -->
+
+ <!-- TV content rating system for FI TV -->
+
+ <!-- TV content rating system for FR TV -->
+
+ <!-- TV content rating system for GR TV -->
+
+ <!-- TV content rating system for HK TV -->
+
+ <!-- TV content rating system for HU TV -->
+
+ <!-- TV content rating system for ID TV -->
+
+ <!-- TV content rating system for IE TV -->
+
+ <!-- TV content rating system for IL TV -->
+
+ <!-- TV content rating system for IN TV -->
+
+ <!-- TV content rating system for IS TV -->
+
+ <!-- TV content rating system for IT TV -->
+
+ <!-- TV content rating system for KH TV -->
+
+ <!-- TV content rating system for KR TV -->
+ <rating-system-definition id="KR_TV"
+ displayName="@string/display_name_krtv"
+ country="KR">
+ <rating-definition id="KR_TV_ALL"
+ displayName="@string/display_name_krtv_all"
+ description="@string/description_krtv_all"
+ ageHint="0" />
+ <rating-definition id="KR_TV_7"
+ displayName="@string/display_name_krtv_7"
+ description="@string/description_krtv_7"
+ ageHint="7" />
+ <rating-definition id="KR_TV_12"
+ displayName="@string/display_name_krtv_12"
+ description="@string/description_krtv_12"
+ ageHint="12" />
+ <rating-definition id="KR_TV_15"
+ displayName="@string/display_name_krtv_15"
+ description="@string/description_krtv_15"
+ ageHint="15" />
+ <rating-definition id="KR_TV_19"
+ displayName="@string/display_name_krtv_19"
+ description="@string/description_krtv_19"
+ ageHint="19" />
+ <order>
+ <rating id="KR_TV_ALL" />
+ <rating id="KR_TV_7" />
+ <rating id="KR_TV_12" />
+ <rating id="KR_TV_15" />
+ <rating id="KR_TV_19" />
+ </order>
+ </rating-system-definition>
+
+ <!-- TV content rating system for MV TV -->
+
+ <!-- TV content rating system for MX TV -->
+
+ <!-- TV content rating system for MY TV -->
+
+ <!-- TV content rating system for NL TV -->
+
+ <!-- TV content rating system for NZ TV -->
+
+ <!-- TV content rating system for PE TV -->
+
+ <!-- TV content rating system for PH TV -->
+
+ <!-- TV content rating system for PL TV -->
+
+ <!-- TV content rating system for PT TV -->
+
+ <!-- TV content rating system for RO TV -->
+
+ <!-- TV content rating system for RU TV -->
+
+ <!-- TV content rating system for RS TV -->
+
+ <!-- TV content rating system for SG TV -->
+
+ <!-- TV content rating system for SI TV -->
+
+ <!-- TV content rating system for TH TV -->
+
+ <!-- TV content rating system for TR TV -->
+
+ <!-- TV content rating system for TW TV -->
+
+ <!-- TV content rating system for UA TV -->
+
+ <!-- TV content rating system for US TV -->
<rating-system-definition id="US_TVPG"
displayName="@string/display_name_ustvpg"
description="@string/description_ustvpg"
@@ -89,39 +207,7 @@
</order>
</rating-system-definition>
- <rating-system-definition id="KR_TV"
- displayName="@string/display_name_krtv"
- country="KR">
- <rating-definition id="KR_TV_ALL"
- displayName="@string/display_name_krtv_all"
- description="@string/description_krtv_all"
- ageHint="0" />
- <rating-definition id="KR_TV_7"
- displayName="@string/display_name_krtv_7"
- description="@string/description_krtv_7"
- ageHint="7">
- </rating-definition>
- <rating-definition id="KR_TV_12"
- displayName="@string/display_name_krtv_12"
- description="@string/description_krtv_12"
- ageHint="12">
- </rating-definition>
- <rating-definition id="KR_TV_15"
- displayName="@string/display_name_krtv_15"
- description="@string/description_krtv_15"
- ageHint="15">
- </rating-definition>
- <rating-definition id="KR_TV_19"
- displayName="@string/display_name_krtv_19"
- description="@string/description_krtv_19"
- ageHint="19">
- </rating-definition>
- <order>
- <rating id="KR_TV_ALL" />
- <rating id="KR_TV_7" />
- <rating id="KR_TV_12" />
- <rating id="KR_TV_15" />
- <rating id="KR_TV_19" />
- </order>
- </rating-system-definition>
+ <!-- TV content rating system for VE TV -->
+
+ <!-- TV content rating system for ZA TV -->
</rating-system-definitions>
diff --git a/media/java/android/media/tv/ITvInputHardware.aidl b/media/java/android/media/tv/ITvInputHardware.aidl
index 3a04161..96223ba 100644
--- a/media/java/android/media/tv/ITvInputHardware.aidl
+++ b/media/java/android/media/tv/ITvInputHardware.aidl
@@ -35,9 +35,9 @@
boolean setSurface(in Surface surface, in TvStreamConfig config);
/**
- * Set volume for this stream via AudioGain. (TBD)
+ * Set volume for this stream via AudioGain.
*/
- void setVolume(float volume);
+ void setStreamVolume(float volume);
/**
* Dispatch key event to HDMI service. The events would be automatically converted to
diff --git a/media/java/android/media/tv/TvContentRating.java b/media/java/android/media/tv/TvContentRating.java
index 1ace775..a1711e5 100644
--- a/media/java/android/media/tv/TvContentRating.java
+++ b/media/java/android/media/tv/TvContentRating.java
@@ -88,14 +88,190 @@
* <td>String value</td>
* <td>Comments</td>
* </tr>
- * <tr>
- * <td>US_TVPG</td>
- * <td>The TV Parental Guidelines for US TV content ratings</td>
- * </tr>
+ * <!--tr>
+ * <td>AM_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>AR_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>AU_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>BG_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>BR_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CA_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CH_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CL_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CO_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>DE_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>DK_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>ES_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>FI_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>FR_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>GR_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>HK_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>HU_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>ID_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IE_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IL_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IN_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IS_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IT_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>KH_TV</td>
+ * <td></td>
+ * </tr-->
* <tr>
* <td>KR_TV</td>
* <td>The South Korean television rating system</td>
* </tr>
+ * <!--tr>
+ * <td>MV_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>MX_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>MY_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>NL_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>NZ_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PE_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PH_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PL_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PT_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>RO_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>RU_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>RS_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>SG_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>SI_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>TH_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>TR_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>TW_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>UA_TV</td>
+ * <td></td>
+ * </tr-->
+ * <tr>
+ * <td>US_TVPG</td>
+ * <td>The TV Parental Guidelines for US TV content ratings</td>
+ * </tr>
+ * <!--tr>
+ * <td>VE_TV</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>ZA_TV</td>
+ * <td></td>
+ * </tr-->
* </table>
*
* <u>System defined string for {@code rating}</u>
@@ -104,16 +280,212 @@
* <td>String value</td>
* <td>Comments</td>
* </tr>
+ * <!--tr>
+ * <td>AM_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>AR_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>AU_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>BG_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>BR_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CA_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CH_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CL_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CO_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>DE_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>DK_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>ES_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>FI_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>FR_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>GR_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>HK_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>HU_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>ID_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IE_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IL_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IN_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IS_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IT_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>KH_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <tr>
+ * <td>KR_TV_ALL</td>
+ * <td>A rating string for {@code KR_TV}. This rating is for programs that are appropriate
+ * for all ages. This program usually involves programs designed for children or families.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>KR_TV_7</td>
+ * <td>A rating string for {@code KR_TV}. This rating is for programs that may contain
+ * material inappropriate for children younger than 7, and parental guidance is required.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>KR_TV_12</td>
+ * <td>A rating string for {@code KR_TV}. This rating is for programs that may contain
+ * material inappropriate for children younger than 12, and parental guidance is required.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>KR_TV_15</td>
+ * <td>A rating string for {@code KR_TV}. This rating is for programs that may contain
+ * material inappropriate for children younger than 15, and parental guidance is required.
+ * </tr>
+ * <tr>
+ * <td>KR_TV_19</td>
+ * <td>A rating string for {@code KR_TV}. This rating is for programs designed for adults
+ * only.</td>
+ * </tr>
+ * <!--tr>
+ * <td>MV_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>MX_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>MY_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>NL_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>NZ_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PE_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PH_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PL_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PT_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>RO_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>RU_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>RS_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>SG_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>SI_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>TH_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>TR_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>TW_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>UA_TV_ALL</td>
+ * <td></td>
+ * </tr-->
* <tr>
* <td>US_TVPG_TV_Y</td>
- * <td>A rating string for the US_TVPG domain. Programs rated this are designed to be
+ * <td>A rating string for {@code US_TVPG}. Programs rated this are designed to be
* appropriate for all children. Whether animated or live-action, the themes and elements
* in this program are specifically designed for a very young audience, including children
* from ages 2-6. This program is not expected to frighten younger children.</td>
* </tr>
* <tr>
* <td>US_TVPG_TV_Y7</td>
- * <td>A rating string for the US_TVPG domain. Programs rated this are designed for children
+ * <td>A rating string for {@code US_TVPG}. Programs rated this are designed for children
* age 7 and above. It may be more appropriate for children who have acquired the
* developmental skills needed to distinguish between make-believe and reality. Themes and
* elements in this program may include mild fantasy violence or comedic violence, or may
@@ -124,7 +496,7 @@
* </tr>
* <tr>
* <td>US_TVPG_TV_G</td>
- * <td>A rating string for the US_TVPG domain. Most parents would find this program suitable
+ * <td>A rating string for {@code US_TVPG}. Most parents would find this program suitable
* for all ages. Although this rating does not signify a program designed specifically for
* children, most parents may let younger children watch this program unattended. It
* contains little or no violence, no strong language and little or no sexual dialogue or
@@ -132,69 +504,39 @@
* </tr>
* <tr>
* <td>US_TVPG_TV_PG</td>
- * <td>A rating string for the US_TVPG domain. Programs rated this contain material that
+ * <td>A rating string for {@code US_TVPG}. Programs rated this contain material that
* parents may find unsuitable for younger children. Many parents may want to watch it with
* their younger children. The theme itself may call for parental guidance and/or the
- * program may contain one or more of the following: some suggestive dialogue (US_TVPG_D),
- * infrequent coarse language (US_TVPG_L), some sexual situations (US_TVPG_S), or moderate
- * violence (US_TVPG_V).</td>
+ * program may contain one or more of the following: some suggestive dialogue (
+ * {@code US_TVPG_D}), infrequent coarse language ({@code US_TVPG_L}), some sexual
+ * situations ({@code US_TVPG_S}), or moderate violence ({@code US_TVPG_V}).</td>
* </tr>
* <tr>
* <td>US_TVPG_TV_14</td>
- * <td>A rating string for the US_TVPG domain. Programs rated this contains some material
+ * <td>A rating string for {@code US_TVPG}. Programs rated this contains some material
* that many parents would find unsuitable for children under 14 years of age. Parents are
* strongly urged to exercise greater care in monitoring this program and are cautioned
* against letting children under the age of 14 watch unattended. This program may contain
- * one or more of the following: intensely suggestive dialogue (US_TVPG_D), strong coarse
- * language (US_TVPG_L), intense sexual situations (US_TVPG_S), or intense violence
- * (US_TVPG_V).</td>
+ * one or more of the following: intensely suggestive dialogue ({@code US_TVPG_D}), strong
+ * coarse language ({@code US_TVPG_L}), intense sexual situations ({@code US_TVPG_S}), or
+ * intense violence ({@code US_TVPG_V}).</td>
* </tr>
* <tr>
* <td>US_TVPG_TV_MA</td>
- * <td>A rating string for the US_TVPG domain. Programs rated TV-MA are specifically
+ * <td>A rating string for {@code US_TVPG}. Programs rated TV-MA are specifically
* designed to be viewed by adults and therefore may be unsuitable for children under 17.
* This program may contain one or more of the following: crude indecent language
- * (US_TVPG_L), explicit sexual activity (US_TVPG_S), or graphic violence (US_TVPG_V).</td>
+ * ({@code US_TVPG_L}), explicit sexual activity ({@code US_TVPG_S}), or graphic violence
+ * ({@code US_TVPG_V}).</td>
* </tr>
- * <tr>
- * <td>KR_TV_ALL</td>
- * <td>A rating string for the KR_TV domain. This rating is for programs that are
- * appropriate for all ages. This program usually involves programs designed for children or
- * families. This rating does not have an icon.</td>
- * </tr>
- * <tr>
- * <td>KR_TV_7</td>
- * <td>A rating string for the KR_TV domain. This rating is for programs that may contain
- * material inappropriate for children younger than 7, and parental discretion should be
- * used. Some cartoon programs not deemed strictly as "educational", and films rated "G" or
- * "PG" in North America may fall into the 7 category.</td>
- * </tr>
- * <tr>
- * <td>KR_TV_12</td>
- * <td>A rating string for the KR_TV domain. This rating is for programs that may deemed
- * inappropriate for those younger than 12, and parental discretion should be used. Usually
- * used for animations that have stronger themes or violence then those designed for
- * children, or for reality shows that have mild violence, themes, or language.</td>
- * </tr>
- * <tr>
- * <td>KR_TV_15</td>
- * <td>A rating string for the KR_TV domain. This rating is for programs that contain
- * material that may be inappropriate for children under 15, and that parental discretion
- * should be used. Examples include most dramas, and talk shows on OTA (over-the-air) TV
- * (KBS, MBC, SBS), and many American TV shows/dramas on Cable TV channels like OCN and
- * OnStyle. The programs that have this rating may include moderate or strong adult themes,
- * language, sexual inference, and violence. As with the TV-14 rating in North America, this
- * rating is commonly applied to live events where the occurrence of inappropriate dialogue
- * is unpredictable. Since 2007, this rating is the most used rating for TV.</td>
- * </tr>
- * <tr>
- * <td>KR_TV_19</td>
- * <td>A rating string for the KR_TV domain. This rating is for programs that are intended
- * for adults only. 19-rated programs cannot air during the hours of 7:00AM to 9:00AM, and
- * 1:00PM to 10:00PM. Programs that receive this rating will almost certainly have adult
- * themes, sexual situations, frequent use of strong language and disturbing scenes of
- * violence.</td>
- * </tr>
+ * <!--tr>
+ * <td>VE_TV_ALL</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>ZA_TV_ALL</td>
+ * <td></td>
+ * </tr-->
* </table>
*
* <u>System defined string for {@code subRating}</u>
@@ -203,6 +545,174 @@
* <td>String value</td>
* <td>Comments</td>
* </tr>
+ * <!--tr>
+ * <td>AM_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>AR_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>AU_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>BG_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>BR_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CA_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CH_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CL_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>CO_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>DE_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>DK_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>ES_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>FI_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>FR_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>GR_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>HK_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>HU_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>ID_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IE_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IL_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IN_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IS_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>IT_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>KH_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>MV_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>MX_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>MY_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>NL_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>NZ_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PE_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PH_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PL_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>PT_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>RO_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>RU_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>RS_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>SG_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>SI_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>TH_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>TR_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>TW_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>UA_TV_</td>
+ * <td></td>
+ * </tr-->
* <tr>
* <td>US_TVPG_D</td>
* <td>Suggestive dialogue (Not used with US_TVPG_TV_MA)</td>
@@ -223,6 +733,14 @@
* <td>US_TVPG_FV</td>
* <td>Fantasy violence (exclusive to US_TVPG_TV_Y7)</td>
* </tr>
+ * <!--tr>
+ * <td>VE_TV_</td>
+ * <td></td>
+ * </tr-->
+ * <!--tr>
+ * <td>ZA_TV_</td>
+ * <td></td>
+ * </tr-->
* </table>
*/
public final class TvContentRating {
@@ -341,7 +859,6 @@
return Collections.unmodifiableList(Arrays.asList(mSubRatings));
}
-
/**
* Returns a String that unambiguously describes both the rating and sub-rating information
* contained in the TvContentRating. You can later recover the TvContentRating from this string
diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java
index 0334083..a555454 100644
--- a/media/java/android/media/tv/TvInputManager.java
+++ b/media/java/android/media/tv/TvInputManager.java
@@ -942,7 +942,7 @@
}
/**
- * Set this as main session. See {@link TvView#setMainTvView} for about meaning of "main".
+ * Sets this as main session. See {@link TvView#setMainTvView} for about meaning of "main".
* @hide
*/
public void setMainSession() {
@@ -1071,7 +1071,7 @@
}
/**
- * Select a track.
+ * Selects a track.
*
* @param track The track to be selected.
* @see #getTracks()
@@ -1092,7 +1092,7 @@
}
/**
- * Unselect a track.
+ * Unselects a track.
*
* @param track The track to be selected.
* @see #getTracks()
@@ -1139,7 +1139,7 @@
}
/**
- * Call {@link TvInputService.Session#appPrivateCommand(String, Bundle)
+ * Calls {@link TvInputService.Session#appPrivateCommand(String, Bundle)
* TvInputService.Session.appPrivateCommand()} on the current TvView.
*
* @param action Name of the command to be performed. This <em>must</em> be a scoped name,
diff --git a/media/java/android/media/tv/TvTrackInfo.java b/media/java/android/media/tv/TvTrackInfo.java
index 3b80db4..f296984 100644
--- a/media/java/android/media/tv/TvTrackInfo.java
+++ b/media/java/android/media/tv/TvTrackInfo.java
@@ -85,7 +85,7 @@
}
/**
- * Returns the audio channel count. Valid for {@link #TYPE_AUDIO} tracks only.
+ * Returns the audio channel count. Valid only for {@link #TYPE_AUDIO} tracks.
*/
public final int getAudioChannelCount() {
if (mType != TYPE_AUDIO) {
@@ -95,7 +95,7 @@
}
/**
- * Returns the audio sample rate, in the unit of Hz. Valid for {@link #TYPE_AUDIO} tracks only.
+ * Returns the audio sample rate, in the unit of Hz. Valid only for {@link #TYPE_AUDIO} tracks.
*/
public final int getAudioSampleRate() {
if (mType != TYPE_AUDIO) {
@@ -105,8 +105,8 @@
}
/**
- * Returns the width of the video, in the unit of pixels. Valid for {@link #TYPE_VIDEO} tracks
- * only.
+ * Returns the width of the video, in the unit of pixels. Valid only for {@link #TYPE_VIDEO}
+ * tracks.
*/
public final int getVideoWidth() {
if (mType != TYPE_VIDEO) {
@@ -116,8 +116,8 @@
}
/**
- * Returns the height of the video, in the unit of pixels. Valid for {@link #TYPE_VIDEO} tracks
- * only.
+ * Returns the height of the video, in the unit of pixels. Valid only for {@link #TYPE_VIDEO}
+ * tracks.
*/
public final int getVideoHeight() {
if (mType != TYPE_VIDEO) {
@@ -206,7 +206,7 @@
}
/**
- * Sets the audio channel count. Valid for {@link #TYPE_AUDIO} tracks only.
+ * Sets the audio channel count. Valid only for {@link #TYPE_AUDIO} tracks.
*
* @param audioChannelCount The audio channel count.
*/
@@ -219,7 +219,8 @@
}
/**
- * Sets the audio sample rate, in the unit of Hz. Valid for {@link #TYPE_AUDIO} tracks only.
+ * Sets the audio sample rate, in the unit of Hz. Valid only for {@link #TYPE_AUDIO}
+ * tracks.
*
* @param audioSampleRate The audio sample rate.
*/
@@ -232,8 +233,8 @@
}
/**
- * Sets the width of the video, in the unit of pixels. Valid for {@link #TYPE_VIDEO} tracks
- * only.
+ * Sets the width of the video, in the unit of pixels. Valid only for {@link #TYPE_VIDEO}
+ * tracks.
*
* @param videoWidth The width of the video.
*/
@@ -246,8 +247,8 @@
}
/**
- * Sets the height of the video, in the unit of pixels. Valid for {@link #TYPE_VIDEO} tracks
- * only.
+ * Sets the height of the video, in the unit of pixels. Valid only for {@link #TYPE_VIDEO}
+ * tracks.
*
* @param videoHeight The height of the video.
*/
diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java
index 2696a63..78b1754 100644
--- a/media/java/android/media/tv/TvView.java
+++ b/media/java/android/media/tv/TvView.java
@@ -162,7 +162,7 @@
}
/**
- * Set this as main TvView.
+ * Sets this as main TvView.
* <p>
* Main TvView is the TvView which user is watching and interacting mainly. It is used for
* determining internal behavior of hardware TV input devices. For example, this influences
@@ -203,7 +203,7 @@
/**
* Tunes to a given channel.
*
- * @param inputId The id of TV input which will play the given channel.
+ * @param inputId The ID of TV input which will play the given channel.
* @param channelUri The URI of a channel.
*/
public void tune(String inputId, Uri channelUri) {
@@ -213,7 +213,7 @@
/**
* Tunes to a given channel.
*
- * @param inputId The id of TV input which will play the given channel.
+ * @param inputId The ID of TV input which will play the given channel.
* @param channelUri The URI of a channel.
* @param params Extra parameters which might be handled with the tune event.
* @hide
@@ -293,7 +293,7 @@
}
/**
- * Select a track.
+ * Selects a track.
* <p>
* If it is called multiple times on the same type of track (ie. Video, Audio, Text), the track
* selected in previous will be unselected. Note that this method does not take any effect
@@ -310,7 +310,7 @@
}
/**
- * Unselect a track.
+ * Unselects a track.
* <p>
* Note that this method does not take any effect unless the current TvView is tuned.
*
@@ -346,7 +346,7 @@
}
/**
- * Call {@link TvInputService.Session#appPrivateCommand(String, Bundle)
+ * Calls {@link TvInputService.Session#appPrivateCommand(String, Bundle)
* TvInputService.Session.appPrivateCommand()} on the current TvView.
*
* @param action Name of the command to be performed. This <em>must</em> be a scoped name, i.e.
@@ -385,8 +385,8 @@
}
/**
- * Called when an unhandled input event was also not handled by the user provided callback. This
- * is the last chance to handle the unhandled input event in the TvView.
+ * Called when an unhandled input event also has not been handled by the user provided
+ * callback. This is the last chance to handle the unhandled input event in the TvView.
*
* @param event The input event.
* @return If you handled the event, return {@code true}. If you want to allow the event to be
@@ -397,9 +397,9 @@
}
/**
- * Registers a callback to be invoked when an input event was not handled by the bound TV input.
+ * Registers a callback to be invoked when an input event is not handled by the bound TV input.
*
- * @param listener The callback to invoke when the unhandled input event was received.
+ * @param listener The callback to be invoked when the unhandled input event is received.
*/
public void setOnUnhandledInputEventListener(OnUnhandledInputEventListener listener) {
mOnUnhandledInputEventListener = listener;
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_action_assist_generic_activated.png b/packages/Keyguard/res/drawable-hdpi/ic_action_assist_generic_activated.png
deleted file mode 100644
index c0e2098..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_action_assist_generic_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-hdpi/ic_action_assist_generic_normal.png b/packages/Keyguard/res/drawable-hdpi/ic_action_assist_generic_normal.png
deleted file mode 100644
index a852e2c..0000000
--- a/packages/Keyguard/res/drawable-hdpi/ic_action_assist_generic_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_action_assist_generic_activated.png b/packages/Keyguard/res/drawable-mdpi/ic_action_assist_generic_activated.png
deleted file mode 100644
index f88f7e1..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_action_assist_generic_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-mdpi/ic_action_assist_generic_normal.png b/packages/Keyguard/res/drawable-mdpi/ic_action_assist_generic_normal.png
deleted file mode 100644
index 7426994..0000000
--- a/packages/Keyguard/res/drawable-mdpi/ic_action_assist_generic_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_action_assist_generic_activated.png b/packages/Keyguard/res/drawable-xhdpi/ic_action_assist_generic_activated.png
deleted file mode 100644
index 500b157..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_action_assist_generic_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_action_assist_generic_normal.png b/packages/Keyguard/res/drawable-xhdpi/ic_action_assist_generic_normal.png
deleted file mode 100644
index d0e4cf3..0000000
--- a/packages/Keyguard/res/drawable-xhdpi/ic_action_assist_generic_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/Keyguard/res/drawable/ic_action_assist_generic.xml b/packages/Keyguard/res/drawable/ic_action_assist_generic.xml
deleted file mode 100644
index 60f5d5d..0000000
--- a/packages/Keyguard/res/drawable/ic_action_assist_generic.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@drawable/ic_action_assist_generic_normal" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_action_assist_generic_activated" />
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="true"
- android:drawable="@drawable/ic_action_assist_generic_activated" />
-
-</selector>
diff --git a/packages/Keyguard/res/layout/keyguard_glow_pad_view.xml b/packages/Keyguard/res/layout/keyguard_glow_pad_view.xml
index 3a466dd..2432336 100644
--- a/packages/Keyguard/res/layout/keyguard_glow_pad_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_glow_pad_view.xml
@@ -28,10 +28,6 @@
android:orientation="horizontal"
android:gravity="@integer/kg_selector_gravity"
android:contentDescription="@string/keyguard_accessibility_slide_area"
-
- prvandroid:targetDrawables="@array/lockscreen_targets_unlock_only"
- prvandroid:targetDescriptions="@array/lockscreen_target_descriptions_unlock_only"
- prvandroid:directionDescriptions="@array/lockscreen_direction_descriptions"
prvandroid:handleDrawable="@drawable/ic_lockscreen_handle"
prvandroid:outerRingDrawable="@drawable/ic_lockscreen_outerring"
prvandroid:outerRadius="@dimen/glowpadview_target_placement_radius"
diff --git a/packages/Keyguard/res/values-land/arrays.xml b/packages/Keyguard/res/values-land/arrays.xml
deleted file mode 100644
index 240b9e4..0000000
--- a/packages/Keyguard/res/values-land/arrays.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/assets/res/any/colors.xml
-**
-** Copyright 2006, 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.
-*/
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-
- <!-- Resources for GlowPadView in LockScreen -->
- <array name="lockscreen_targets_when_silent">
- <item>@null</item>"
- <item>@drawable/ic_action_assist_generic</item>
- <item>@drawable/ic_lockscreen_soundon</item>
- <item>@drawable/ic_lockscreen_unlock</item>
- </array>
-
- <array name="lockscreen_target_descriptions_when_silent">
- <item>@null</item>
- <item>@string/description_target_search</item>
- <item>@string/description_target_soundon</item>
- <item>@string/description_target_unlock</item>
- </array>
-
- <array name="lockscreen_direction_descriptions">
- <item>@null</item>
- <item>@string/description_direction_up</item>
- <item>@string/description_direction_left</item>
- <item>@string/description_direction_down</item>
- </array>
-
- <array name="lockscreen_targets_when_soundon">
- <item>@null</item>
- <item>@drawable/ic_action_assist_generic</item>
- <item>@drawable/ic_lockscreen_silent</item>
- <item>@drawable/ic_lockscreen_unlock</item>
- </array>
-
- <array name="lockscreen_target_descriptions_when_soundon">
- <item>@null</item>
- <item>@string/description_target_search</item>
- <item>@string/description_target_silent</item>
- <item>@string/description_target_unlock</item>
- </array>
-
- <array name="lockscreen_targets_with_camera">
- <item>@null</item>
- <item>@drawable/ic_action_assist_generic</item>
- <item>@drawable/ic_lockscreen_camera</item>
- <item>@drawable/ic_lockscreen_unlock</item>
- </array>
-
- <array name="lockscreen_target_descriptions_with_camera">
- <item>@null</item>
- <item>@string/description_target_search</item>
- <item>@string/description_target_camera</item>
- <item>@string/description_target_unlock</item>
- </array>
-
-</resources>
diff --git a/packages/Keyguard/res/values-sw600dp-land/arrays.xml b/packages/Keyguard/res/values-sw600dp-land/arrays.xml
deleted file mode 100644
index 5550216..0000000
--- a/packages/Keyguard/res/values-sw600dp-land/arrays.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/assets/res/any/colors.xml
-**
-** Copyright 2006, 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.
-*/
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-
- <!-- Resources for GlowPadView in LockScreen -->
- <array name="lockscreen_targets_when_silent">
- <item>@drawable/ic_lockscreen_unlock</item>
- <item>@null</item>
- <item>@drawable/ic_lockscreen_soundon</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_target_descriptions_when_silent">
- <item>@string/description_target_unlock</item>
- <item>@null</item>
- <item>@string/description_target_soundon</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_direction_descriptions">
- <item>@string/description_direction_right</item>
- <item>@null</item>
- <item>@string/description_direction_left</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_targets_when_soundon">
- <item>@drawable/ic_lockscreen_unlock</item>
- <item>@null</item>
- <item>@drawable/ic_lockscreen_silent</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_target_descriptions_when_soundon">
- <item>@string/description_target_unlock</item>
- <item>@null</item>
- <item>@string/description_target_silent</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_targets_with_camera">
- <item>@drawable/ic_lockscreen_unlock</item>
- <item>@drawable/ic_action_assist_generic</item>
- <item>@drawable/ic_lockscreen_camera</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_target_descriptions_with_camera">
- <item>@string/description_target_unlock</item>
- <item>@string/description_target_search</item>
- <item>@string/description_target_camera</item>
- <item>@null</item>
- </array>
-
-</resources>
diff --git a/packages/Keyguard/res/values/arrays.xml b/packages/Keyguard/res/values/arrays.xml
index 291f776..a8b3c1b 100644
--- a/packages/Keyguard/res/values/arrays.xml
+++ b/packages/Keyguard/res/values/arrays.xml
@@ -19,64 +19,6 @@
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- Resources for GlowPadView in LockScreen -->
- <array name="lockscreen_targets_when_silent">
- <item>@drawable/ic_lockscreen_unlock</item>
- <item>@drawable/ic_action_assist_generic</item>
- <item>@drawable/ic_lockscreen_soundon</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_target_descriptions_when_silent">
- <item>@string/description_target_unlock</item>
- <item>@string/description_target_search</item>
- <item>@string/description_target_soundon</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_direction_descriptions">
- <item>@string/description_direction_right</item>
- <item>@string/description_direction_up</item>
- <item>@string/description_direction_left</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_targets_when_soundon">
- <item>@drawable/ic_lockscreen_unlock</item>
- <item>@drawable/ic_action_assist_generic</item>
- <item>@drawable/ic_lockscreen_silent</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_target_descriptions_when_soundon">
- <item>@string/description_target_unlock</item>
- <item>@string/description_target_search</item>
- <item>@string/description_target_silent</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_targets_with_camera">
- <item>@drawable/ic_lockscreen_unlock</item>
- <item>@drawable/ic_action_assist_generic</item>
- <item>@drawable/ic_lockscreen_camera</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_target_descriptions_with_camera">
- <item>@string/description_target_unlock</item>
- <item>@string/description_target_search</item>
- <item>@string/description_target_camera</item>
- <item>@null</item>
- </array>
-
- <array name="lockscreen_targets_unlock_only">
- <item>@drawable/ic_lockscreen_unlock</item>
- </array>
-
- <array name="lockscreen_target_descriptions_unlock_only">
- <item>@string/description_target_unlock</item>
- </array>
-
<!-- list of 3- or 4-letter mnemonics for a 10-key numeric keypad -->
<string-array translatable="false" name="lockscreen_num_pad_klondike">
<item>+</item><!-- 0 -->
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
index 7727e4a..9dd6bc2 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -73,16 +73,22 @@
@Override
public void onResume(int reason) {
- getSecurityView(mCurrentSecuritySelection).onResume(reason);
+ if (mCurrentSecuritySelection != SecurityMode.None) {
+ getSecurityView(mCurrentSecuritySelection).onResume(reason);
+ }
}
@Override
public void onPause() {
- getSecurityView(mCurrentSecuritySelection).onPause();
+ if (mCurrentSecuritySelection != SecurityMode.None) {
+ getSecurityView(mCurrentSecuritySelection).onPause();
+ }
}
public void startAppearAnimation() {
- getSecurityView(mCurrentSecuritySelection).startAppearAnimation();
+ if (mCurrentSecuritySelection != SecurityMode.None) {
+ getSecurityView(mCurrentSecuritySelection).startAppearAnimation();
+ }
}
void updateSecurityViews(boolean isBouncing) {
@@ -119,12 +125,6 @@
view = (KeyguardSecurityView)v;
}
- if (view instanceof KeyguardSelectorView) {
- KeyguardSelectorView selectorView = (KeyguardSelectorView) view;
- View carrierText = selectorView.findViewById(R.id.keyguard_selector_fade_container);
- selectorView.setCarrierArea(carrierText);
- }
-
return view;
}
@@ -375,8 +375,10 @@
oldView.onPause();
oldView.setKeyguardCallback(mNullCallback); // ignore requests from old view
}
- newView.onResume(KeyguardSecurityView.VIEW_REVEALED);
- newView.setKeyguardCallback(mCallback);
+ if (securityMode != SecurityMode.None) {
+ newView.onResume(KeyguardSecurityView.VIEW_REVEALED);
+ newView.setKeyguardCallback(mCallback);
+ }
// Find and show this child.
final int childCount = mSecurityViewFlipper.getChildCount();
@@ -390,7 +392,8 @@
}
mCurrentSecuritySelection = securityMode;
- mSecurityCallback.onSecurityModeChanged(securityMode, newView.needsInput());
+ mSecurityCallback.onSecurityModeChanged(securityMode,
+ securityMode != SecurityMode.None && newView.needsInput());
}
private KeyguardSecurityViewFlipper getFlipper() {
@@ -472,7 +475,6 @@
private int getSecurityViewIdForMode(SecurityMode securityMode) {
switch (securityMode) {
- case None: return R.id.keyguard_selector_view;
case Pattern: return R.id.keyguard_pattern_view;
case PIN: return R.id.keyguard_pin_view;
case Password: return R.id.keyguard_password_view;
@@ -486,7 +488,6 @@
private int getLayoutIdFor(SecurityMode securityMode) {
switch (securityMode) {
- case None: return R.layout.keyguard_selector_view;
case Pattern: return R.layout.keyguard_pattern_view;
case PIN: return R.layout.keyguard_pin_view;
case Password: return R.layout.keyguard_password_view;
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
deleted file mode 100644
index 85bd87d..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (C) 2012 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.keyguard;
-
-import android.animation.ObjectAnimator;
-import android.app.SearchManager;
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.drawable.Drawable;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.util.Slog;
-import android.view.View;
-import android.widget.LinearLayout;
-
-import com.android.internal.telephony.IccCardConstants.State;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.internal.widget.multiwaveview.GlowPadView;
-import com.android.internal.widget.multiwaveview.GlowPadView.OnTriggerListener;
-
-public class KeyguardSelectorView extends LinearLayout implements KeyguardSecurityView {
- private static final String TAG = "SecuritySelectorView";
- private static final String ASSIST_ICON_METADATA_NAME =
- "com.android.systemui.action_assist_icon";
-
- private KeyguardSecurityCallback mCallback;
- private GlowPadView mGlowPadView;
- private ObjectAnimator mAnim;
- private View mFadeView;
- private boolean mIsBouncing;
- private boolean mCameraDisabled;
- private boolean mSearchDisabled;
- private LockPatternUtils mLockPatternUtils;
- private SecurityMessageDisplay mSecurityMessageDisplay;
- private Drawable mBouncerFrame;
-
- OnTriggerListener mOnTriggerListener = new OnTriggerListener() {
-
- public void onTrigger(View v, int target) {
- final int resId = mGlowPadView.getResourceIdForTarget(target);
-
- if (resId == R.drawable.ic_lockscreen_unlock_phantom
- || resId == R.drawable.ic_lockscreen_unlock) {
- mCallback.userActivity();
- mCallback.dismiss(false);
- }
- }
-
- public void onReleased(View v, int handle) {
- if (!mIsBouncing) {
- doTransition(mFadeView, 1.0f);
- }
- }
-
- public void onGrabbed(View v, int handle) {
- mCallback.userActivity();
- doTransition(mFadeView, 0.0f);
- }
-
- public void onGrabbedStateChange(View v, int handle) {
-
- }
-
- public void onFinishFinalAnimation() {
-
- }
-
- };
-
- KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
-
- @Override
- public void onDevicePolicyManagerStateChanged() {
- updateTargets();
- }
-
- @Override
- public void onSimStateChanged(State simState) {
- updateTargets();
- }
- };
-
- public KeyguardSelectorView(Context context) {
- this(context, null);
- }
-
- public KeyguardSelectorView(Context context, AttributeSet attrs) {
- super(context, attrs);
- mLockPatternUtils = new LockPatternUtils(getContext());
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view);
- mGlowPadView.setOnTriggerListener(mOnTriggerListener);
- updateTargets();
-
- mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);
- View bouncerFrameView = findViewById(R.id.keyguard_selector_view_frame);
- mBouncerFrame = bouncerFrameView.getBackground();
- }
-
- public void setCarrierArea(View carrierArea) {
- mFadeView = carrierArea;
- }
-
- public boolean isTargetPresent(int resId) {
- return mGlowPadView.getTargetPosition(resId) != -1;
- }
-
- @Override
- public void showUsabilityHint() {
- mGlowPadView.ping();
- }
-
- private void updateTargets() {
- int currentUserHandle = mLockPatternUtils.getCurrentUser();
- DevicePolicyManager dpm = mLockPatternUtils.getDevicePolicyManager();
- int disabledFeatures = dpm.getKeyguardDisabledFeatures(null, currentUserHandle);
- boolean secureCameraDisabled = mLockPatternUtils.isSecure()
- && (disabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0;
- boolean cameraDisabledByAdmin = dpm.getCameraDisabled(null, currentUserHandle)
- || secureCameraDisabled;
- final KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(getContext());
- boolean disabledBySimState = monitor.isSimLocked();
- boolean cameraTargetPresent =
- isTargetPresent(R.drawable.ic_lockscreen_camera);
- boolean searchTargetPresent =
- isTargetPresent(R.drawable.ic_action_assist_generic);
-
- if (cameraDisabledByAdmin) {
- Log.v(TAG, "Camera disabled by Device Policy");
- } else if (disabledBySimState) {
- Log.v(TAG, "Camera disabled by Sim State");
- }
- boolean currentUserSetup = 0 != Settings.Secure.getIntForUser(
- mContext.getContentResolver(),
- Settings.Secure.USER_SETUP_COMPLETE,
- 0 /*default */,
- currentUserHandle);
- boolean searchActionAvailable =
- ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, false, UserHandle.USER_CURRENT) != null;
- mCameraDisabled = cameraDisabledByAdmin || disabledBySimState || !cameraTargetPresent
- || !currentUserSetup;
- mSearchDisabled = disabledBySimState || !searchActionAvailable || !searchTargetPresent
- || !currentUserSetup;
- updateResources();
- }
-
- public void updateResources() {
- // Update the search icon with drawable from the search .apk
- if (!mSearchDisabled) {
- Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, false, UserHandle.USER_CURRENT);
- if (intent != null) {
- // XXX Hack. We need to substitute the icon here but haven't formalized
- // the public API. The "_google" metadata will be going away, so
- // DON'T USE IT!
- ComponentName component = intent.getComponent();
- boolean replaced = mGlowPadView.replaceTargetDrawablesIfPresent(component,
- ASSIST_ICON_METADATA_NAME + "_google", R.drawable.ic_action_assist_generic);
-
- if (!replaced && !mGlowPadView.replaceTargetDrawablesIfPresent(component,
- ASSIST_ICON_METADATA_NAME, R.drawable.ic_action_assist_generic)) {
- Slog.w(TAG, "Couldn't grab icon from package " + component);
- }
- }
- }
-
- mGlowPadView.setEnableTarget(R.drawable.ic_lockscreen_camera, !mCameraDisabled);
- mGlowPadView.setEnableTarget(R.drawable.ic_action_assist_generic, !mSearchDisabled);
- }
-
- void doTransition(View view, float to) {
- if (mAnim != null) {
- mAnim.cancel();
- }
- mAnim = ObjectAnimator.ofFloat(view, "alpha", to);
- mAnim.start();
- }
-
- public void setKeyguardCallback(KeyguardSecurityCallback callback) {
- mCallback = callback;
- }
-
- public void setLockPatternUtils(LockPatternUtils utils) {
- mLockPatternUtils = utils;
- }
-
- @Override
- public void reset() {
- mGlowPadView.reset(false);
- }
-
- @Override
- public boolean needsInput() {
- return false;
- }
-
- @Override
- public void onPause() {
- KeyguardUpdateMonitor.getInstance(getContext()).removeCallback(mUpdateCallback);
- }
-
- @Override
- public void onResume(int reason) {
- KeyguardUpdateMonitor.getInstance(getContext()).registerCallback(mUpdateCallback);
- }
-
- @Override
- public KeyguardSecurityCallback getCallback() {
- return mCallback;
- }
-
- @Override
- public void showBouncer(int duration) {
- mIsBouncing = true;
- KeyguardSecurityViewHelper.
- showBouncer(mSecurityMessageDisplay, mFadeView, mBouncerFrame, duration);
- }
-
- @Override
- public void hideBouncer(int duration) {
- mIsBouncing = false;
- KeyguardSecurityViewHelper.
- hideBouncer(mSecurityMessageDisplay, mFadeView, mBouncerFrame, duration);
- }
-
- @Override
- public void startAppearAnimation() {
- // noop.
- }
-}
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_activated.png b/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_activated.png
deleted file mode 100644
index c0e2098..0000000
--- a/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_normal.png b/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_normal.png
deleted file mode 100644
index a852e2c..0000000
--- a/packages/SystemUI/res/drawable-hdpi/ic_action_assist_generic_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-land/search_panel_scrim.xml b/packages/SystemUI/res/drawable-land/search_panel_scrim.xml
new file mode 100644
index 0000000..102cc9c
--- /dev/null
+++ b/packages/SystemUI/res/drawable-land/search_panel_scrim.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ 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
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient
+ android:type="linear"
+ android:angle="180"
+ android:startColor="#55000000"
+ android:endColor="#00000000" />
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_activated.png b/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_activated.png
deleted file mode 100644
index f88f7e1..0000000
--- a/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_normal.png b/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_normal.png
deleted file mode 100644
index 7426994..0000000
--- a/packages/SystemUI/res/drawable-mdpi/ic_action_assist_generic_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp/search_panel_scrim.xml b/packages/SystemUI/res/drawable-sw600dp/search_panel_scrim.xml
new file mode 100644
index 0000000..bbb2617
--- /dev/null
+++ b/packages/SystemUI/res/drawable-sw600dp/search_panel_scrim.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ 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
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient
+ android:type="linear"
+ android:angle="90"
+ android:startColor="#55000000"
+ android:endColor="#00000000" />
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_activated.png b/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_activated.png
deleted file mode 100644
index 500b157..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_normal.png b/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_normal.png
deleted file mode 100644
index d0e4cf3..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/ic_action_assist_generic_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_activated.png b/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_activated.png
deleted file mode 100644
index cc38e83..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_activated.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_normal.png b/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_normal.png
deleted file mode 100644
index 42f96eb..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_action_assist_generic_normal.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable/ic_action_assist_generic.xml b/packages/SystemUI/res/drawable/ic_action_assist_generic.xml
deleted file mode 100644
index 60f5d5d..0000000
--- a/packages/SystemUI/res/drawable/ic_action_assist_generic.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@drawable/ic_action_assist_generic_normal" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_action_assist_generic_activated" />
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="true"
- android:drawable="@drawable/ic_action_assist_generic_activated" />
-
-</selector>
diff --git a/packages/SystemUI/res/drawable/ic_clear_all.xml b/packages/SystemUI/res/drawable/ic_dismiss_all.xml
similarity index 61%
rename from packages/SystemUI/res/drawable/ic_clear_all.xml
rename to packages/SystemUI/res/drawable/ic_dismiss_all.xml
index 187a420..8e5e572 100644
--- a/packages/SystemUI/res/drawable/ic_clear_all.xml
+++ b/packages/SystemUI/res/drawable/ic_dismiss_all.xml
@@ -14,12 +14,17 @@
~ limitations under the License
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="32dp"
- android:height="32dp"
- android:viewportWidth="48.0"
- android:viewportHeight="48.0">
-
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
<path
- android:fillColor="#FFFFFFFF"
- android:pathData="M10.0,26.0l28.0,0.0l0.0,-4.0L10.0,22.0L10.0,26.0zM6.0,34.0l28.0,0.0l0.0,-4.0L6.0,30.0L6.0,34.0zM14.0,14.0l0.0,4.0l28.0,0.0l0.0,-4.0L14.0,14.0z"/>
+ android:fillColor="#ffffff"
+ android:pathData="M8.0,19.994l32.0,0.0l0.0,8.0l-32.0,0.0z"/>
+ <path
+ android:fillColor="#ffffff"
+ android:pathData="M0.0,32.0l32.0,0.0l0.0,7.979l-32.0,0.0z"/>
+ <path
+ android:fillColor="#ffffff"
+ android:pathData="M16.0,8.0l32.0,0.0l0.0,8.0l-32.0,0.0z"/>
</vector>
diff --git a/packages/SystemUI/res/drawable/search_panel_card_bg.xml b/packages/SystemUI/res/drawable/search_panel_card_bg.xml
new file mode 100644
index 0000000..c19f900
--- /dev/null
+++ b/packages/SystemUI/res/drawable/search_panel_card_bg.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ 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
+ -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/search_panel_card_color" />
+ <corners android:radius="@dimen/notification_material_rounded_rect_radius" />
+</shape>
diff --git a/packages/SystemUI/res/drawable/search_panel_scrim.xml b/packages/SystemUI/res/drawable/search_panel_scrim.xml
new file mode 100644
index 0000000..bbb2617
--- /dev/null
+++ b/packages/SystemUI/res/drawable/search_panel_scrim.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ 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
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient
+ android:type="linear"
+ android:angle="90"
+ android:startColor="#55000000"
+ android:endColor="#00000000" />
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout-land/status_bar_search_panel.xml b/packages/SystemUI/res/layout-land/status_bar_search_panel.xml
deleted file mode 100644
index ddffd6e..0000000
--- a/packages/SystemUI/res/layout-land/status_bar_search_panel.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2012, 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.
-*/
--->
-
-<com.android.systemui.SearchPanelView
- xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/search_panel_container"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:paddingBottom="0dip">
-
- <RelativeLayout
- android:id="@+id/search_bg_protect"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginBottom="0dip">
-
- <RelativeLayout
- android:id="@+id/search_panel_container"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_alignParentEnd="true">
-
- <com.android.internal.widget.multiwaveview.GlowPadView
- android:id="@+id/glow_pad_view"
- android:orientation="vertical"
- android:layout_width="@dimen/navbar_search_panel_height"
- android:layout_height="match_parent"
- android:layout_alignParentBottom="true"
- android:gravity="start"
-
- prvandroid:targetDrawables="@array/navbar_search_targets"
- prvandroid:targetDescriptions="@array/navbar_search_target_descriptions"
- prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
- prvandroid:outerRingDrawable="@drawable/navbar_search_outerring"
- prvandroid:outerRadius="@dimen/navbar_search_outerring_radius"
- prvandroid:innerRadius="@dimen/glowpadview_inner_radius"
- prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
- prvandroid:feedbackCount="0"
- prvandroid:vibrationDuration="@integer/config_vibration_duration"
- prvandroid:alwaysTrackFinger="true"
- prvandroid:glowRadius="@dimen/glowpadview_glow_radius"
- prvandroid:pointDrawable="@drawable/ic_lockscreen_glowdot"
- />
-
- </RelativeLayout>
-
- </RelativeLayout>
-
-</com.android.systemui.SearchPanelView>
diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml
deleted file mode 100644
index 08f61bb..0000000
--- a/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* apps/common/assets/default/default/skins/StatusBar.xml
-**
-** Copyright 2012, 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.
-*/
--->
-
-<com.android.systemui.SearchPanelView
- xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/search_panel_container"
- android:layout_height="match_parent"
- android:layout_width="match_parent">
-
- <com.android.internal.widget.multiwaveview.GlowPadView
- android:id="@+id/glow_pad_view"
- android:layout_width="wrap_content"
- android:layout_height="@dimen/navbar_search_panel_height"
- android:layout_gravity="center_horizontal|bottom"
- android:gravity="center_horizontal|top"
-
- prvandroid:targetDrawables="@array/navbar_search_targets"
- prvandroid:targetDescriptions="@array/navbar_search_target_descriptions"
- prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
- prvandroid:outerRingDrawable="@drawable/navbar_search_outerring"
- prvandroid:outerRadius="@dimen/navbar_search_outerring_radius"
- prvandroid:innerRadius="@dimen/glowpadview_inner_radius"
- prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
- prvandroid:feedbackCount="0"
- prvandroid:vibrationDuration="@integer/config_vibration_duration"
- prvandroid:alwaysTrackFinger="true"
- prvandroid:glowRadius="@dimen/glowpadview_glow_radius"
- prvandroid:pointDrawable="@drawable/ic_lockscreen_glowdot"/>
-
-</com.android.systemui.SearchPanelView>
diff --git a/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml b/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml
index 515270a..f506adc 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml
@@ -21,20 +21,11 @@
android:layout_height="wrap_content"
android:visibility="gone"
>
- <Button
+ <ImageButton
android:id="@+id/dismiss_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:minHeight="0dp"
- android:textColor="#ffffffff"
- android:text="@string/clear_all_notifications_text"
- android:textSize="18sp"
- android:textAllCaps="true"
- android:paddingTop="@dimen/clear_all_padding_top"
- android:paddingEnd="8dp"
- android:layout_gravity="end|center_vertical"
- android:drawableEnd="@drawable/ic_clear_all"
- android:drawablePadding="4dp"
- android:fontFamily="sans-serif-light"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="end"
+ android:src="@drawable/ic_dismiss_all"
android:background="@drawable/ripple_drawable" />
</com.android.systemui.statusbar.DismissView>
diff --git a/packages/SystemUI/res/layout/status_bar_search_panel.xml b/packages/SystemUI/res/layout/status_bar_search_panel.xml
index c01db7c..f025abd 100644
--- a/packages/SystemUI/res/layout/status_bar_search_panel.xml
+++ b/packages/SystemUI/res/layout/status_bar_search_panel.xml
@@ -18,50 +18,29 @@
*/
-->
+<!-- Extends FrameLayout -->
<com.android.systemui.SearchPanelView
- xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/search_panel_container"
android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:paddingBottom="0dip">
+ android:layout_width="match_parent">
- <RelativeLayout
- android:id="@+id/search_bg_protect"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginBottom="0dip">
+ <com.android.systemui.statusbar.AlphaOptimizedView
+ style="@style/SearchPanelScrim"
+ android:id="@+id/search_panel_scrim"
+ android:background="@drawable/search_panel_scrim" />
- <RelativeLayout
- android:id="@+id/search_panel_container"
- android:layout_width="match_parent"
+ <FrameLayout
+ style="@style/SearchPanelCard"
+ android:id="@+id/search_panel_card"
+ android:background="@drawable/search_panel_card_bg"
+ android:elevation="12dp">
+
+ <ImageView
+ style="@style/SearchPanelLogo"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentBottom="true">
-
- <com.android.internal.widget.multiwaveview.GlowPadView
- android:id="@+id/glow_pad_view"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="@dimen/navbar_search_panel_height"
- android:layout_alignParentBottom="true"
- android:gravity="top"
-
- prvandroid:targetDrawables="@array/navbar_search_targets"
- prvandroid:targetDescriptions="@array/navbar_search_target_descriptions"
- prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
- prvandroid:outerRingDrawable="@drawable/navbar_search_outerring"
- prvandroid:outerRadius="@dimen/navbar_search_outerring_radius"
- prvandroid:innerRadius="@dimen/glowpadview_inner_radius"
- prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
- prvandroid:feedbackCount="0"
- prvandroid:vibrationDuration="@integer/config_vibration_duration"
- prvandroid:alwaysTrackFinger="true"
- prvandroid:glowRadius="@dimen/glowpadview_glow_radius"
- prvandroid:pointDrawable="@drawable/ic_lockscreen_glowdot"
- />
-
- </RelativeLayout>
-
- </RelativeLayout>
+ android:id="@+id/search_logo" />
+ </FrameLayout>
</com.android.systemui.SearchPanelView>
diff --git a/packages/SystemUI/res/values-land/arrays.xml b/packages/SystemUI/res/values-land/arrays.xml
deleted file mode 100644
index c32ce12..0000000
--- a/packages/SystemUI/res/values-land/arrays.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/assets/res/any/colors.xml
-**
-** Copyright 2012, 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.
-*/
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-
- <array name="navbar_search_targets">
- <item>@null</item>
- <item>@null</item>
- <item>@drawable/ic_action_assist_generic</item>
- <item>@null</item>
- </array>
-
- <array name="navbar_search_target_descriptions">
- <item>@null</item>
- <item>@null</item>
- <item>@string/description_target_search</item>
- <item>@null</item>
- </array>
-
- <array name="navbar_search_direction_descriptions">
- <item>@null</item>
- <item>@null</item>
- <item>@string/description_direction_left</item>
- <item>@null</item>
- </array>
-
-</resources>
diff --git a/packages/SystemUI/res/values-land/styles.xml b/packages/SystemUI/res/values-land/styles.xml
index 8919198..682998d 100644
--- a/packages/SystemUI/res/values-land/styles.xml
+++ b/packages/SystemUI/res/values-land/styles.xml
@@ -18,4 +18,22 @@
<style name="BrightnessDialogContainer" parent="@style/BaseBrightnessDialogContainer">
<item name="android:layout_width">360dp</item>
</style>
+
+ <style name="SearchPanelCard">
+ <item name="android:layout_width">@dimen/search_panel_card_height</item>
+ <item name="android:layout_height">match_parent</item>
+ <item name="android:layout_marginTop">16dp</item>
+ <item name="android:layout_marginBottom">16dp</item>
+ <item name="android:layout_gravity">right</item>
+ </style>
+
+ <style name="SearchPanelLogo">
+ <item name="android:layout_gravity">top|left</item>
+ </style>
+
+ <style name="SearchPanelScrim">
+ <item name="android:layout_width">@dimen/search_panel_scrim_height</item>
+ <item name="android:layout_height">match_parent</item>
+ <item name="android:layout_gravity">right</item>
+ </style>
</resources>
diff --git a/packages/SystemUI/res/values-sw600dp/arrays.xml b/packages/SystemUI/res/values-sw600dp/arrays.xml
deleted file mode 100644
index 21c4bd3..0000000
--- a/packages/SystemUI/res/values-sw600dp/arrays.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/assets/res/any/colors.xml
-**
-** Copyright 2012, 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.
-*/
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-
- <array name="navbar_search_targets">
- <item>@null</item>
- <item>@drawable/ic_action_assist_generic</item>
- <item>@null</item>
- <item>@null</item>
- </array>
-
- <array name="navbar_search_target_descriptions">
- <item>@null</item>
- <item>@string/description_target_search</item>
- <item>@null</item>
- <item>@null</item>
- </array>
-
- <array name="navbar_search_direction_descriptions">
- <item>@null</item>
- <item>@string/description_direction_left</item>
- <item>@null</item>
- <item>@null</item>
- </array>
-
-</resources>
diff --git a/packages/SystemUI/res/values-sw600dp/styles.xml b/packages/SystemUI/res/values-sw600dp/styles.xml
index d4a99866..88372bc 100644
--- a/packages/SystemUI/res/values-sw600dp/styles.xml
+++ b/packages/SystemUI/res/values-sw600dp/styles.xml
@@ -29,4 +29,20 @@
<item name="android:layout_width">@dimen/notification_panel_width</item>
<item name="android:layout_gravity">center_horizontal</item>
</style>
+
+ <style name="SearchPanelCard">
+ <item name="android:layout_width">550dp</item>
+ <item name="android:layout_height">@dimen/search_panel_card_height</item>
+ <item name="android:layout_gravity">center_horizontal|bottom</item>
+ </style>
+
+ <style name="SearchPanelLogo">
+ <item name="android:layout_gravity">top|center_horizontal</item>
+ </style>
+
+ <style name="SearchPanelScrim">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">@dimen/search_panel_scrim_height</item>
+ <item name="android:layout_gravity">bottom</item>
+ </style>
</resources>
diff --git a/packages/SystemUI/res/values/arrays.xml b/packages/SystemUI/res/values/arrays.xml
index 6628f3b..630a48d 100644
--- a/packages/SystemUI/res/values/arrays.xml
+++ b/packages/SystemUI/res/values/arrays.xml
@@ -18,27 +18,6 @@
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-
- <array name="navbar_search_targets">
- <item>@null</item>
- <item>@drawable/ic_action_assist_generic</item>
- <item>@null</item>
- <item>@null</item>
- </array>
-
- <array name="navbar_search_target_descriptions">
- <item>@null</item>
- <item>@string/description_target_search</item>
- <item>@null</item>
- <item>@null</item>
- </array>
-
- <array name="navbar_search_direction_descriptions">
- <item>@null</item>
- <item>@string/description_direction_up</item>
- <item>@null</item>
- <item>@null</item>
- </array>
<!-- BatteryMeterView parameters -->
<array name="batterymeter_color_levels">
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index a63deb0..1cdcc2b 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -101,4 +101,6 @@
<color name="notification_guts_title_color">#FFFFFFFF</color>
<color name="notification_guts_text_color">#99FFFFFF</color>
<color name="notification_guts_btn_color">#FFFFFFFF</color>
+
+ <color name="search_panel_card_color">#ffffff</color>
</resources>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 32425ad..f2c9e85 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -381,7 +381,7 @@
<dimen name="battery_level_padding_end">4dp</dimen>
<!-- The top padding of the clear all button -->
- <dimen name="clear_all_padding_top">4dp</dimen>
+ <dimen name="clear_all_padding_top">12dp</dimen>
<!-- Largest size an avatar might need to be drawn in the user picker, status bar, or
quick settings header -->
@@ -399,4 +399,17 @@
<!-- Additional translation (downwards) for appearing notifications when going to the full shade
from Keyguard. -->
<dimen name="go_to_full_shade_appearing_translation">200dp</dimen>
+
+ <!-- The height of the search panel card. -->
+ <dimen name="search_panel_card_height">300dp</dimen>
+
+ <!-- The height of the scrim behind the search panel card. -->
+ <dimen name="search_panel_scrim_height">250dp</dimen>
+
+ <!-- How much from the bottom of the screen the card should peek in when activating the search
+ panel -->
+ <dimen name="search_card_peek_height">100dp</dimen>
+
+ <!-- How far the user needs to drag up to invoke search. -->
+ <dimen name="search_panel_threshold">150dp</dimen>
</resources>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 61e6121..197c0f1 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -280,4 +280,22 @@
<item name="android:textStyle">italic</item>
<item name="android:textColor">#60000000</item>
</style>
+
+ <style name="SearchPanelCard">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">@dimen/search_panel_card_height</item>
+ <item name="android:layout_marginStart">8dp</item>
+ <item name="android:layout_marginEnd">8dp</item>
+ <item name="android:layout_gravity">bottom</item>
+ </style>
+
+ <style name="SearchPanelLogo">
+ <item name="android:layout_gravity">top|center_horizontal</item>
+ </style>
+
+ <style name="SearchPanelScrim">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">@dimen/search_panel_scrim_height</item>
+ <item name="android:layout_gravity">bottom</item>
+ </style>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
index ed03733..7d0ca14 100644
--- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
@@ -16,46 +16,41 @@
package com.android.systemui;
-import android.animation.LayoutTransition;
-import android.app.ActivityManagerNative;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ObjectAnimator;
+import android.animation.PropertyValuesHolder;
import android.app.ActivityOptions;
import android.app.SearchManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.media.AudioAttributes;
-import android.os.RemoteException;
-import android.os.ServiceManager;
+import android.os.AsyncTask;
+import android.os.Bundle;
import android.os.UserHandle;
import android.os.Vibrator;
import android.provider.Settings;
import android.util.AttributeSet;
-import android.util.EventLog;
import android.util.Log;
-import android.view.IWindowManager;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
-import android.view.ViewTreeObserver.OnPreDrawListener;
+import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
import android.widget.FrameLayout;
+import android.widget.ImageView;
-import com.android.internal.widget.multiwaveview.GlowPadView;
-import com.android.internal.widget.multiwaveview.GlowPadView.OnTriggerListener;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.StatusBarPanel;
-import com.android.systemui.statusbar.phone.KeyguardTouchDelegate;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
-public class SearchPanelView extends FrameLayout implements
- StatusBarPanel, ActivityOptions.OnAnimationStartedListener {
- private static final int SEARCH_PANEL_HOLD_DURATION = 0;
- static final String TAG = "SearchPanelView";
- static final boolean DEBUG = PhoneStatusBar.DEBUG || false;
- public static final boolean DEBUG_GESTURES = true;
+public class SearchPanelView extends FrameLayout implements StatusBarPanel {
+
+ private static final String TAG = "SearchPanelView";
private static final String ASSIST_ICON_METADATA_NAME =
"com.android.systemui.action_assist_icon";
@@ -67,10 +62,26 @@
private final Context mContext;
private BaseStatusBar mBar;
- private boolean mShowing;
- private View mSearchTargetsContainer;
- private GlowPadView mGlowPadView;
- private IWindowManager mWm;
+ private View mCard;
+ private ImageView mLogo;
+ private View mScrim;
+
+ private int mPeekHeight;
+ private int mThreshold;
+ private boolean mHorizontal;
+ private final Interpolator mLinearOutSlowInInterpolator;
+ private final Interpolator mFastOutLinearInInterpolator;
+
+ private boolean mAnimatingIn;
+ private boolean mAnimatingOut;
+ private boolean mDragging;
+ private boolean mDraggedFarEnough;
+ private float mStartTouch;
+ private float mStartDrag;
+
+ private ObjectAnimator mEnterAnimator;
+
+ private boolean mStartExitAfterAnimatingIn;
public SearchPanelView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
@@ -79,7 +90,12 @@
public SearchPanelView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mContext = context;
- mWm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
+ mPeekHeight = context.getResources().getDimensionPixelSize(R.dimen.search_card_peek_height);
+ mThreshold = context.getResources().getDimensionPixelSize(R.dimen.search_panel_threshold);
+ mLinearOutSlowInInterpolator =
+ AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in);
+ mFastOutLinearInInterpolator =
+ AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_linear_in);
}
private void startAssistActivity() {
@@ -87,92 +103,34 @@
// Close Recent Apps if needed
mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
- boolean isKeyguardShowing = false;
+
+ final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
+ .getAssistIntent(mContext, true, UserHandle.USER_CURRENT);
+ if (intent == null) return;
+
try {
- isKeyguardShowing = mWm.isKeyguardLocked();
- } catch (RemoteException e) {
-
+ final ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
+ R.anim.search_launch_enter, R.anim.search_launch_exit);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ AsyncTask.execute(new Runnable() {
+ @Override
+ public void run() {
+ mContext.startActivityAsUser(intent, opts.toBundle(),
+ new UserHandle(UserHandle.USER_CURRENT));
+ }
+ });
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "Activity not found for " + intent.getAction());
}
-
- if (isKeyguardShowing) {
- // Have keyguard show the bouncer and launch the activity if the user succeeds.
- KeyguardTouchDelegate.getInstance(getContext()).showAssistant();
- onAnimationStarted();
- } else {
- // Otherwise, keyguard isn't showing so launch it from here.
- Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, true, UserHandle.USER_CURRENT);
- if (intent == null) return;
-
- try {
- ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
- } catch (RemoteException e) {
- // too bad, so sad...
- }
-
- try {
- ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
- R.anim.search_launch_enter, R.anim.search_launch_exit,
- getHandler(), this);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mContext.startActivityAsUser(intent, opts.toBundle(),
- new UserHandle(UserHandle.USER_CURRENT));
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "Activity not found for " + intent.getAction());
- onAnimationStarted();
- }
- }
- }
-
- class GlowPadTriggerListener implements GlowPadView.OnTriggerListener {
- boolean mWaitingForLaunch;
-
- public void onGrabbed(View v, int handle) {
- }
-
- public void onReleased(View v, int handle) {
- }
-
- public void onGrabbedStateChange(View v, int handle) {
- if (!mWaitingForLaunch && OnTriggerListener.NO_HANDLE == handle) {
- mBar.hideSearchPanel();
- }
- }
-
- public void onTrigger(View v, final int target) {
- final int resId = mGlowPadView.getResourceIdForTarget(target);
- switch (resId) {
- case R.drawable.ic_action_assist_generic:
- mWaitingForLaunch = true;
- startAssistActivity();
- vibrate();
- break;
- }
- }
-
- public void onFinishFinalAnimation() {
- }
- }
- final GlowPadTriggerListener mGlowPadViewListener = new GlowPadTriggerListener();
-
- @Override
- public void onAnimationStarted() {
- postDelayed(new Runnable() {
- public void run() {
- mGlowPadViewListener.mWaitingForLaunch = false;
- mBar.hideSearchPanel();
- }
- }, SEARCH_PANEL_HOLD_DURATION);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mSearchTargetsContainer = findViewById(R.id.search_panel_container);
- // TODO: fetch views
- mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view);
- mGlowPadView.setOnTriggerListener(mGlowPadViewListener);
+ mCard = findViewById(R.id.search_panel_card);
+ mLogo = (ImageView) findViewById(R.id.search_logo);
+ mScrim = findViewById(R.id.search_panel_scrim);
}
private void maybeSwapSearchIcon() {
@@ -180,12 +138,36 @@
.getAssistIntent(mContext, false, UserHandle.USER_CURRENT);
if (intent != null) {
ComponentName component = intent.getComponent();
- if (component == null || !mGlowPadView.replaceTargetDrawablesIfPresent(component,
- ASSIST_ICON_METADATA_NAME,
- R.drawable.ic_action_assist_generic)) {
- if (DEBUG) Log.v(TAG, "Couldn't grab icon for component " + component);
+ replaceDrawable(mLogo, component, ASSIST_ICON_METADATA_NAME);
+ } else {
+ mLogo.setImageDrawable(null);
+ }
+ }
+
+ public void replaceDrawable(ImageView v, ComponentName component, String name) {
+ if (component != null) {
+ try {
+ PackageManager packageManager = mContext.getPackageManager();
+ // Look for the search icon specified in the activity meta-data
+ Bundle metaData = packageManager.getActivityInfo(
+ component, PackageManager.GET_META_DATA).metaData;
+ if (metaData != null) {
+ int iconResId = metaData.getInt(name);
+ if (iconResId != 0) {
+ Resources res = packageManager.getResourcesForActivity(component);
+ v.setImageDrawable(res.getDrawable(iconResId));
+ return;
+ }
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.w(TAG, "Failed to swap drawable; "
+ + component.flattenToShortString() + " not found", e);
+ } catch (Resources.NotFoundException nfe) {
+ Log.w(TAG, "Failed to swap drawable from "
+ + component.flattenToShortString(), nfe);
}
}
+ v.setImageDrawable(null);
}
private boolean pointInside(int x, int y, View v) {
@@ -197,17 +179,9 @@
}
public boolean isInContentArea(int x, int y) {
- return pointInside(x, y, mSearchTargetsContainer);
+ return pointInside(x, y, mCard);
}
- private final OnPreDrawListener mPreDrawListener = new ViewTreeObserver.OnPreDrawListener() {
- public boolean onPreDraw() {
- getViewTreeObserver().removeOnPreDrawListener(this);
- mGlowPadView.resumeAnimations();
- return false;
- }
- };
-
private void vibrate() {
Context context = getContext();
if (Settings.System.getIntForUser(context.getContentResolver(),
@@ -220,49 +194,108 @@
}
public void show(final boolean show, boolean animate) {
- if (!show) {
- final LayoutTransition transitioner = animate ? createLayoutTransitioner() : null;
- ((ViewGroup) mSearchTargetsContainer).setLayoutTransition(transitioner);
- }
- mShowing = show;
if (show) {
maybeSwapSearchIcon();
if (getVisibility() != View.VISIBLE) {
setVisibility(View.VISIBLE);
- // Don't start the animation until we've created the layer, which is done
- // right before we are drawn
- mGlowPadView.suspendAnimations();
- mGlowPadView.ping();
- getViewTreeObserver().addOnPreDrawListener(mPreDrawListener);
vibrate();
+ mCard.setAlpha(1f);
+ if (animate) {
+ startEnterAnimation();
+ } else {
+ mScrim.setAlpha(1f);
+ if (mHorizontal) {
+ mCard.setX(getWidth() - mPeekHeight);
+ } else {
+ mCard.setY(getHeight() - mPeekHeight);
+ }
+ }
}
setFocusable(true);
setFocusableInTouchMode(true);
requestFocus();
} else {
- setVisibility(View.INVISIBLE);
+ if (animate) {
+ startAbortAnimation();
+ } else {
+ setVisibility(View.INVISIBLE);
+ }
}
}
+ private void startEnterAnimation() {
+ if (mHorizontal) {
+ mCard.setX(getWidth());
+ } else {
+ mCard.setY(getHeight());
+ }
+ mAnimatingIn = true;
+ mCard.animate().cancel();
+ mEnterAnimator = ObjectAnimator.ofFloat(mCard, mHorizontal ? View.X : View.Y,
+ mHorizontal ? mCard.getX() : mCard.getY(),
+ mHorizontal ? getWidth() - mPeekHeight : getHeight() - mPeekHeight);
+ mEnterAnimator.setDuration(300);
+ mEnterAnimator.setStartDelay(50);
+ mEnterAnimator.setInterpolator(mLinearOutSlowInInterpolator);
+ mEnterAnimator.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mEnterAnimator = null;
+ mAnimatingIn = false;
+ if (mStartExitAfterAnimatingIn) {
+ startExitAnimation();
+ }
+ }
+ });
+ mEnterAnimator.start();
+ mScrim.setAlpha(0f);
+ mScrim.animate()
+ .alpha(1f)
+ .setDuration(300)
+ .setStartDelay(50)
+ .setInterpolator(PhoneStatusBar.ALPHA_IN)
+ .start();
+
+ }
+
+ private void startAbortAnimation() {
+ mCard.animate().cancel();
+ mAnimatingOut = true;
+ if (mHorizontal) {
+ mCard.animate().x(getWidth());
+ } else {
+ mCard.animate().y(getHeight());
+ }
+ mCard.animate()
+ .setDuration(150)
+ .setInterpolator(mFastOutLinearInInterpolator)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ mAnimatingOut = false;
+ setVisibility(View.INVISIBLE);
+ }
+ });
+ mScrim.animate()
+ .alpha(0f)
+ .setDuration(150)
+ .setStartDelay(0)
+ .setInterpolator(PhoneStatusBar.ALPHA_OUT);
+ }
+
public void hide(boolean animate) {
if (mBar != null) {
// This will indirectly cause show(false, ...) to get called
mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
} else {
- setVisibility(View.INVISIBLE);
+ if (animate) {
+ startAbortAnimation();
+ } else {
+ setVisibility(View.INVISIBLE);
+ }
}
}
- /**
- * We need to be aligned at the bottom. LinearLayout can't do this, so instead,
- * let LinearLayout do all the hard work, and then shift everything down to the bottom.
- */
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- super.onLayout(changed, l, t, r, b);
- // setPanelHeight(mSearchTargetsContainer.getHeight());
- }
-
@Override
public boolean dispatchHoverEvent(MotionEvent event) {
// Ignore hover events outside of this panel bounds since such events
@@ -281,34 +314,113 @@
* when the animation is done.
*/
public boolean isShowing() {
- return mShowing;
+ return getVisibility() == View.VISIBLE && !mAnimatingOut;
}
public void setBar(BaseStatusBar bar) {
mBar = bar;
}
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- if (DEBUG_GESTURES) {
- if (event.getActionMasked() != MotionEvent.ACTION_MOVE) {
- EventLog.writeEvent(EventLogTags.SYSUI_SEARCHPANEL_TOUCH,
- event.getActionMasked(), (int) event.getX(), (int) event.getY());
- }
- }
- return super.onTouchEvent(event);
- }
-
- private LayoutTransition createLayoutTransitioner() {
- LayoutTransition transitioner = new LayoutTransition();
- transitioner.setDuration(200);
- transitioner.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, 0);
- transitioner.setAnimator(LayoutTransition.DISAPPEARING, null);
- return transitioner;
- }
-
public boolean isAssistantAvailable() {
return ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
.getAssistIntent(mContext, false, UserHandle.USER_CURRENT) != null;
}
+
+ private float rubberband(float diff) {
+ return Math.signum(diff) * (float) Math.pow(Math.abs(diff), 0.8f);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ int action = event.getActionMasked();
+ switch (action) {
+ case MotionEvent.ACTION_DOWN:
+ mStartTouch = mHorizontal ? event.getX() : event.getY();
+ mDragging = false;
+ mDraggedFarEnough = false;
+ mStartExitAfterAnimatingIn = false;
+ break;
+ case MotionEvent.ACTION_MOVE:
+ float currentTouch = mHorizontal ? event.getX() : event.getY();
+ if (getVisibility() == View.VISIBLE && !mDragging &&
+ (!mAnimatingIn || Math.abs(mStartTouch - currentTouch) > mThreshold)) {
+ mStartDrag = currentTouch;
+ mDragging = true;
+ }
+ if (!mDraggedFarEnough && Math.abs(mStartTouch - currentTouch) > mThreshold) {
+ mDraggedFarEnough = true;
+ }
+ if (mDragging) {
+ if (!mAnimatingIn && !mAnimatingOut) {
+ if (Math.abs(currentTouch - mStartDrag) > mThreshold) {
+ startExitAnimation();
+ } else {
+ if (mHorizontal) {
+ mCard.setX(getWidth() - mPeekHeight + rubberband(
+ currentTouch - mStartDrag));
+ } else {
+ mCard.setY(getHeight() - mPeekHeight + rubberband(
+ currentTouch - mStartDrag));
+ }
+ }
+ } else if (mAnimatingIn ) {
+ float diff = rubberband(currentTouch - mStartDrag);
+ PropertyValuesHolder[] values = mEnterAnimator.getValues();
+ values[0].setFloatValues(
+ mHorizontal ? getWidth() + diff : getHeight() + diff,
+ mHorizontal
+ ? getWidth() - mPeekHeight + diff
+ : getHeight() - mPeekHeight + diff);
+ mEnterAnimator.setCurrentPlayTime(mEnterAnimator.getCurrentPlayTime());
+ }
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_CANCEL:
+ if (mDraggedFarEnough) {
+ if (mAnimatingIn) {
+ mStartExitAfterAnimatingIn = true;
+ } else {
+ startExitAnimation();
+ }
+ } else {
+ startAbortAnimation();
+ }
+ break;
+ }
+ return true;
+ }
+
+ private void startExitAnimation() {
+ if (mAnimatingOut || getVisibility() != View.VISIBLE) {
+ return;
+ }
+ if (mEnterAnimator != null) {
+ mEnterAnimator.cancel();
+ }
+ mAnimatingOut = true;
+ startAssistActivity();
+ vibrate();
+ mCard.animate()
+ .alpha(0f)
+ .withLayer()
+ .setDuration(250)
+ .setInterpolator(PhoneStatusBar.ALPHA_OUT)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ mAnimatingOut = false;
+ setVisibility(View.INVISIBLE);
+ }
+ });
+ mScrim.animate()
+ .alpha(0f)
+ .setDuration(250)
+ .setStartDelay(0)
+ .setInterpolator(PhoneStatusBar.ALPHA_OUT);
+ }
+
+ public void setHorizontal(boolean horizontal) {
+ mHorizontal = horizontal;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 617c445d..c2f6aa4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -909,14 +909,12 @@
if (DEBUG) Log.d(TAG, "opening search panel");
if (mSearchPanelView != null && mSearchPanelView.isAssistantAvailable()) {
mSearchPanelView.show(true, true);
- onShowSearchPanel();
}
break;
case MSG_CLOSE_SEARCH_PANEL:
if (DEBUG) Log.d(TAG, "closing search panel");
if (mSearchPanelView != null && mSearchPanelView.isShowing()) {
mSearchPanelView.show(false, true);
- onHideSearchPanel();
}
break;
}
@@ -948,12 +946,6 @@
protected void workAroundBadLayerDrawableOpacity(View v) {
}
- protected void onHideSearchPanel() {
- }
-
- protected void onShowSearchPanel() {
- }
-
private boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) {
return inflateViews(entry, parent, false);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DismissView.java b/packages/SystemUI/src/com/android/systemui/statusbar/DismissView.java
index 9712ee2..f674b065 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/DismissView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/DismissView.java
@@ -19,23 +19,18 @@
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
-import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
-import android.view.animation.PathInterpolator;
-import android.widget.Button;
-import android.widget.TextView;
+
import com.android.systemui.R;
+import com.android.systemui.statusbar.phone.PhoneStatusBar;
public class DismissView extends ExpandableView {
- private Button mClearAllText;
+ private View mClearAllIcon;
private boolean mIsVisible;
private boolean mAnimating;
private boolean mWillBeGone;
- private final Interpolator mAppearInterpolator = new PathInterpolator(0f, 0.2f, 1f, 1f);
- private final Interpolator mDisappearInterpolator = new PathInterpolator(0f, 0f, 0.8f, 1f);
-
public DismissView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@@ -43,7 +38,7 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mClearAllText = (Button) findViewById(R.id.dismiss_text);
+ mClearAllIcon = findViewById(R.id.dismiss_text);
setInvisible();
}
@@ -83,12 +78,12 @@
float endValue = nowVisible ? 1.0f : 0.0f;
Interpolator interpolator;
if (nowVisible) {
- interpolator = mAppearInterpolator;
+ interpolator = PhoneStatusBar.ALPHA_IN;
} else {
- interpolator = mDisappearInterpolator;
+ interpolator = PhoneStatusBar.ALPHA_OUT;
}
mAnimating = true;
- mClearAllText.animate()
+ mClearAllIcon.animate()
.alpha(endValue)
.setInterpolator(interpolator)
.setDuration(260)
@@ -111,7 +106,7 @@
}
public void setInvisible() {
- mClearAllText.setAlpha(0.0f);
+ mClearAllIcon.setAlpha(0.0f);
mIsVisible = false;
}
@@ -134,7 +129,7 @@
}
public void setOnButtonClickListener(OnClickListener onClickListener) {
- mClearAllText.setOnClickListener(onClickListener);
+ mClearAllIcon.setOnClickListener(onClickListener);
}
@Override
@@ -143,7 +138,7 @@
}
public void cancelAnimation() {
- mClearAllText.animate().cancel();
+ mClearAllIcon.animate().cancel();
}
public boolean willBeGone() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
index 303454b..152bfdc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
@@ -109,10 +109,6 @@
mBarBackground.finishAnimation();
}
- public void setContentVisible(boolean visible) {
- // for subclasses
- }
-
private static class BarBackgroundDrawable extends Drawable {
private final int mOpaque;
private final int mSemiTransparent;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
index 3753a72..50ddeb3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
@@ -108,18 +108,6 @@
return max;
}
- @Override
- public void setContentVisible(boolean visible) {
- final float alpha = visible ? 1 : 0;
- fadeContent(mView.getBackButton(), alpha);
- }
-
- private void fadeContent(View v, float alpha) {
- if (v != null) {
- v.animate().alpha(alpha).setDuration(CONTENT_FADE_DURATION);
- }
- }
-
private void setKeyButtonViewQuiescentAlpha(View button, float alpha, boolean animate) {
if (button instanceof KeyButtonView) {
((KeyButtonView) button).setQuiescentAlpha(alpha, animate);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 21842bf..95cb9a11 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -88,6 +88,8 @@
// performs manual animation in sync with layout transitions
private final NavTransitionListener mTransitionListener = new NavTransitionListener();
+ private OnVerticalChangedListener mOnVerticalChangedListener;
+
private class NavTransitionListener implements TransitionListener {
private boolean mBackTransitioning;
private boolean mHomeAppearing;
@@ -193,6 +195,10 @@
mDelegateHelper.setBar(phoneStatusBar);
}
+ public void setOnVerticalChangedListener(OnVerticalChangedListener onVerticalChangedListener) {
+ mOnVerticalChangedListener = onVerticalChangedListener;
+ }
+
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mDeadZone != null && event.getAction() == MotionEvent.ACTION_OUTSIDE) {
@@ -413,7 +419,7 @@
// swap to x coordinate if orientation is not in vertical
if (mDelegateHelper != null) {
- mDelegateHelper.setSwapXY(!mVertical);
+ mDelegateHelper.setSwapXY(mVertical);
}
setNavigationIconHints(mNavigationIconHints, true);
@@ -435,6 +441,9 @@
mVertical = newVertical;
//Log.v(TAG, String.format("onSizeChanged: h=%d, w=%d, vert=%s", h, w, mVertical?"y":"n"));
reorient();
+ if (mOnVerticalChangedListener != null) {
+ mOnVerticalChangedListener.onVerticalChanged(newVertical);
+ }
}
postCheckForInvalidLayout("sizeChanged");
@@ -542,4 +551,7 @@
pw.println();
}
+ public interface OnVerticalChangedListener {
+ void onVerticalChanged(boolean isVertical);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 3ec2395..3c111b6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -501,31 +501,11 @@
@Override
public void onAnimationEnd(Animator animation) {
if (clearAllExpandHack && !mCancelled) {
- mHeightAnimator = createHeightAnimator(getMaxPanelHeight());
- mHeightAnimator.setInterpolator(mLinearOutSlowInInterpolator);
- mHeightAnimator.setDuration(350);
- mHeightAnimator.addListener(new AnimatorListenerAdapter() {
- private boolean mCancelled;
-
- @Override
- public void onAnimationCancel(Animator animation) {
- mCancelled = true;
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- mHeightAnimator = null;
- if (!mCancelled) {
- notifyExpandingFinished();
- }
- }
- });
- mHeightAnimator.start();
- } else {
- mHeightAnimator = null;
- if (!mCancelled) {
- notifyExpandingFinished();
- }
+ setExpandedHeightInternal(getMaxPanelHeight());
+ }
+ mHeightAnimator = null;
+ if (!mCancelled) {
+ notifyExpandingFinished();
}
}
});
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 99b0259..8dfed92 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -641,6 +641,15 @@
mNavigationBarView.setDisabledFlags(mDisabled);
mNavigationBarView.setBar(this);
+ mNavigationBarView.setOnVerticalChangedListener(
+ new NavigationBarView.OnVerticalChangedListener() {
+ @Override
+ public void onVerticalChanged(boolean isVertical) {
+ if (mSearchPanelView != null) {
+ mSearchPanelView.setHorizontal(isVertical);
+ }
+ }
+ });
mNavigationBarView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
@@ -951,20 +960,6 @@
}
@Override
- protected void onShowSearchPanel() {
- if (mNavigationBarView != null) {
- mNavigationBarView.getBarTransitions().setContentVisible(false);
- }
- }
-
- @Override
- protected void onHideSearchPanel() {
- if (mNavigationBarView != null) {
- mNavigationBarView.getBarTransitions().setContentVisible(true);
- }
- }
-
- @Override
protected View getStatusBarView() {
return mStatusBarView;
}
@@ -989,8 +984,6 @@
}
lp.gravity = Gravity.BOTTOM | Gravity.START;
lp.setTitle("SearchPanel");
- // TODO: Define custom animation for Search panel
- lp.windowAnimations = com.android.internal.R.style.Animation_RecentApplications;
lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
return lp;
@@ -1066,7 +1059,7 @@
View.OnTouchListener mHomeActionListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()) {
- case MotionEvent.ACTION_DOWN:
+ case MotionEvent.ACTION_DOWN:
if (!shouldDisableNavbarGestures()) {
mHandler.removeCallbacks(mShowSearchPanel);
mHandler.postDelayed(mShowSearchPanel, mShowSearchHoldoff);
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index 74ae812..4687e3f 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -204,7 +204,7 @@
private boolean mNotificationShown;
private final boolean mImeSelectedOnBoot;
- class SessionState {
+ static class SessionState {
final ClientState client;
final IInputMethod method;
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java
index cbccc1d..c33b35f 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecController.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java
@@ -502,24 +502,30 @@
@ServiceThreadOnly
private void onReceiveCommand(HdmiCecMessage message) {
assertRunOnServiceThread();
- if (isAcceptableAddress(message.getDestination())
- && mService.handleCecCommand(message)) {
+ if (isAcceptableAddress(message.getDestination()) && mService.handleCecCommand(message)) {
return;
}
- if (message.getDestination() == Constants.ADDR_BROADCAST) {
- return;
- }
- if (message.getOpcode() == Constants.MESSAGE_FEATURE_ABORT) {
- Slog.v(TAG, "Unhandled <Feature Abort> message:" + message);
- return;
- }
+ // Not handled message, so we will reply it with <Feature Abort>.
+ maySendFeatureAbortCommand(message, Constants.ABORT_UNRECOGNIZED_OPCODE);
+ }
- int sourceAddress = message.getDestination();
- // Reply <Feature Abort> to initiator (source) for all requests.
- HdmiCecMessage cecMessage = HdmiCecMessageBuilder.buildFeatureAbortCommand(
- sourceAddress, message.getSource(), message.getOpcode(),
- Constants.ABORT_REFUSED);
- sendCommand(cecMessage);
+ @ServiceThreadOnly
+ void maySendFeatureAbortCommand(HdmiCecMessage message, int reason) {
+ assertRunOnServiceThread();
+ // Swap the source and the destination.
+ int src = message.getDestination();
+ int dest = message.getSource();
+ if (src == Constants.ADDR_BROADCAST || dest == Constants.ADDR_UNREGISTERED) {
+ // Don't reply <Feature Abort> from the unregistered devices or for the broadcasted
+ // messages. See CEC 12.2 Protocol General Rules for detail.
+ return;
+ }
+ int originalOpcode = message.getOpcode();
+ if (originalOpcode == Constants.MESSAGE_FEATURE_ABORT) {
+ return;
+ }
+ sendCommand(
+ HdmiCecMessageBuilder.buildFeatureAbortCommand(src, dest, originalOpcode, reason));
}
@ServiceThreadOnly
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
index 7b382c6..cf16fa3 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
@@ -153,7 +153,7 @@
/**
* Called once a logical address of the local device is allocated.
*/
- protected abstract void onAddressAllocated(int logicalAddress, boolean fromBootup);
+ protected abstract void onAddressAllocated(int logicalAddress, int reason);
/**
* Get the preferred logical address from system properties.
@@ -308,11 +308,8 @@
protected boolean handleGetMenuLanguage(HdmiCecMessage message) {
assertRunOnServiceThread();
Slog.w(TAG, "Only TV can handle <Get Menu Language>:" + message.toString());
- mService.sendCecCommand(
- HdmiCecMessageBuilder.buildFeatureAbortCommand(mAddress,
- message.getSource(), Constants.MESSAGE_GET_MENU_LANGUAGE,
- Constants.ABORT_UNRECOGNIZED_OPCODE));
- return true;
+ // 'return false' will cause to reply with <Feature Abort>.
+ return false;
}
@ServiceThreadOnly
@@ -431,9 +428,7 @@
} else if (message.getDestination() != Constants.ADDR_BROADCAST &&
message.getSource() != Constants.ADDR_UNREGISTERED) {
Slog.v(TAG, "Wrong direct vendor command. Replying with <Feature Abort>");
- mService.sendCecCommand(HdmiCecMessageBuilder.buildFeatureAbortCommand(mAddress,
- message.getSource(), Constants.MESSAGE_VENDOR_COMMAND_WITH_ID,
- Constants.ABORT_UNRECOGNIZED_OPCODE));
+ mService.maySendFeatureAbortCommand(message, Constants.ABORT_UNRECOGNIZED_OPCODE);
} else {
Slog.v(TAG, "Wrong broadcast vendor command. Ignoring");
}
@@ -448,8 +443,7 @@
protected boolean handleRecordTvScreen(HdmiCecMessage message) {
// The default behavior of <Record TV Screen> is replying <Feature Abort> with
// "Cannot provide source".
- mService.sendCecCommand(HdmiCecMessageBuilder.buildFeatureAbortCommand(mAddress,
- message.getSource(), message.getOpcode(), Constants.ABORT_CANNOT_PROVIDE_SOURCE));
+ mService.maySendFeatureAbortCommand(message, Constants.ABORT_CANNOT_PROVIDE_SOURCE);
return true;
}
@@ -458,10 +452,10 @@
}
@ServiceThreadOnly
- final void handleAddressAllocated(int logicalAddress, boolean fromBootup) {
+ final void handleAddressAllocated(int logicalAddress, int reason) {
assertRunOnServiceThread();
mAddress = mPreferredAddress = logicalAddress;
- onAddressAllocated(logicalAddress, fromBootup);
+ onAddressAllocated(logicalAddress, reason);
setPreferredAddress(logicalAddress);
}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java
index a66d78c..b05f1af 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java
@@ -39,10 +39,15 @@
@Override
@ServiceThreadOnly
- protected void onAddressAllocated(int logicalAddress, boolean fromBootup) {
+ protected void onAddressAllocated(int logicalAddress, int reason) {
assertRunOnServiceThread();
mService.sendCecCommand(HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(
mAddress, mService.getPhysicalAddress(), mDeviceType));
+ if (reason == HdmiControlService.INITIATED_BY_SCREEN_ON) {
+ oneTouchPlay(new IHdmiControlCallback.Stub() {
+ @Override public void onComplete(int result) throws RemoteException {}
+ });
+ }
}
@Override
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index 8b2ed93..70d108a 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -120,13 +120,14 @@
@Override
@ServiceThreadOnly
- protected void onAddressAllocated(int logicalAddress, boolean fromBootup) {
+ protected void onAddressAllocated(int logicalAddress, int reason) {
assertRunOnServiceThread();
mService.sendCecCommand(HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(
mAddress, mService.getPhysicalAddress(), mDeviceType));
mService.sendCecCommand(HdmiCecMessageBuilder.buildDeviceVendorIdCommand(
mAddress, mService.getVendorId()));
- launchRoutingControl(fromBootup);
+ launchRoutingControl(reason != HdmiControlService.INITIATED_BY_ENABLE_CEC &&
+ reason != HdmiControlService.INITIATED_BY_BOOT_UP);
launchDeviceDiscovery();
}
@@ -899,6 +900,10 @@
mService.invokeTimerRecordingResult(result);
}
+ void announceClearTimerRecordingResult(int result) {
+ mService.invokeClearTimerRecordingResult(result);
+ }
+
private boolean isMessageForSystemAudio(HdmiCecMessage message) {
if (message.getSource() != Constants.ADDR_AUDIO_SYSTEM
|| message.getDestination() != Constants.ADDR_TV
@@ -1226,8 +1231,9 @@
// LocalDeviceTv.onAddressAllocated() -> launchDeviceDiscovery().
removeAction(DeviceDiscoveryAction.class);
removeAction(HotplugDetectionAction.class);
- // Remove one touch record action.
+ // Remove recording actions.
removeAction(OneTouchRecordAction.class);
+ removeAction(TimerRecordingAction.class);
disableSystemAudioIfExist();
disableArcIfExist();
@@ -1396,19 +1402,19 @@
assertRunOnServiceThread();
if (!mService.isControlEnabled()) {
Slog.w(TAG, "Can not start one touch record. CEC control is disabled.");
- announceTimerRecordingResult(CLEAR_TIMER_STATUS_CEC_DISABLE);
+ announceClearTimerRecordingResult(CLEAR_TIMER_STATUS_CEC_DISABLE);
return;
}
if (!checkRecorder(recorderAddress)) {
Slog.w(TAG, "Invalid recorder address:" + recorderAddress);
- announceTimerRecordingResult(CLEAR_TIMER_STATUS_CHECK_RECORDER_CONNECTION);
+ announceClearTimerRecordingResult(CLEAR_TIMER_STATUS_CHECK_RECORDER_CONNECTION);
return;
}
if (!checkTimerRecordingSource(sourceType, recordSource)) {
Slog.w(TAG, "Invalid record source." + Arrays.toString(recordSource));
- announceTimerRecordingResult(CLEAR_TIMER_STATUS_FAIL_TO_CLEAR_SELECTED_SOURCE);
+ announceClearTimerRecordingResult(CLEAR_TIMER_STATUS_FAIL_TO_CLEAR_SELECTED_SOURCE);
return;
}
@@ -1432,7 +1438,7 @@
break;
default:
Slog.w(TAG, "Invalid source type:" + recorderAddress);
- announceTimerRecordingResult(CLEAR_TIMER_STATUS_FAIL_TO_CLEAR_SELECTED_SOURCE);
+ announceClearTimerRecordingResult(CLEAR_TIMER_STATUS_FAIL_TO_CLEAR_SELECTED_SOURCE);
return;
}
@@ -1440,7 +1446,8 @@
@Override
public void onSendCompleted(int error) {
if (error != Constants.SEND_RESULT_SUCCESS) {
- announceTimerRecordingResult(CLEAR_TIMER_STATUS_FAIL_TO_CLEAR_SELECTED_SOURCE);
+ announceClearTimerRecordingResult(
+ CLEAR_TIMER_STATUS_FAIL_TO_CLEAR_SELECTED_SOURCE);
}
}
});
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecStandbyModeHandler.java b/services/core/java/com/android/server/hdmi/HdmiCecStandbyModeHandler.java
index c653125..8c40424 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecStandbyModeHandler.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecStandbyModeHandler.java
@@ -48,16 +48,7 @@
}
@Override
public boolean handle(HdmiCecMessage message) {
- int src = message.getSource();
- int dest = message.getDestination();
- if (src == Constants.ADDR_BROADCAST || dest == Constants.ADDR_BROADCAST) {
- // Do not send <Feature Abort> on the message from the unassigned device
- // or the broadcasted message.
- return true;
- }
- HdmiCecMessage cecMessage = HdmiCecMessageBuilder.buildFeatureAbortCommand(
- dest, src, message.getOpcode(), mReason);
- mService.sendCecCommand(cecMessage);
+ mService.maySendFeatureAbortCommand(message, mReason);
return true;
}
}
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 435507d..fe55b01 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -73,6 +73,12 @@
static final String PERMISSION = "android.permission.HDMI_CEC";
+ // The reason code to initiate intializeCec().
+ static final int INITIATED_BY_ENABLE_CEC = 0;
+ static final int INITIATED_BY_BOOT_UP = 1;
+ static final int INITIATED_BY_SCREEN_ON = 2;
+ static final int INITIATED_BY_WAKE_UP_MESSAGE = 3;
+
/**
* Interface to report send result.
*/
@@ -216,6 +222,9 @@
@ServiceThreadOnly
private boolean mStandbyMessageReceived = false;
+ @ServiceThreadOnly
+ private boolean mWakeUpMessageReceived = false;
+
public HdmiControlService(Context context) {
super(context);
mLocalDevices = HdmiUtils.asImmutableList(getContext().getResources().getIntArray(
@@ -237,7 +246,7 @@
// TODO: load value for mHdmiControlEnabled from preference.
if (mHdmiControlEnabled) {
- initializeCec(true);
+ initializeCec(INITIATED_BY_BOOT_UP);
}
} else {
Slog.i(TAG, "Device does not support HDMI-CEC.");
@@ -264,6 +273,11 @@
* Called when the initialization of local devices is complete.
*/
private void onInitializeCecComplete() {
+ if (mPowerStatus == HdmiControlManager.POWER_STATUS_TRANSIENT_TO_ON) {
+ mPowerStatus = HdmiControlManager.POWER_STATUS_ON;
+ }
+ mWakeUpMessageReceived = false;
+
if (isTvDevice()) {
mCecController.setOption(HdmiTvClient.OPTION_CEC_AUTO_WAKEUP,
tv().getAutoWakeup() ? HdmiTvClient.ENABLED : HdmiTvClient.DISABLED);
@@ -280,18 +294,18 @@
Global.putInt(cr, key, value ? Constants.TRUE : Constants.FALSE);
}
- private void initializeCec(boolean fromBootup) {
+ private void initializeCec(int initiatedBy) {
mCecController.setOption(HdmiTvClient.OPTION_CEC_SERVICE_CONTROL,
HdmiTvClient.ENABLED);
- initializeLocalDevices(mLocalDevices, fromBootup);
+ initializeLocalDevices(mLocalDevices, initiatedBy);
}
@ServiceThreadOnly
- private void initializeLocalDevices(final List<Integer> deviceTypes, final boolean fromBootup) {
+ private void initializeLocalDevices(final List<Integer> deviceTypes, final int initiatedBy) {
assertRunOnServiceThread();
// A container for [Logical Address, Local device info].
final SparseArray<HdmiCecLocalDevice> devices = new SparseArray<>();
- final SparseIntArray finished = new SparseIntArray();
+ final int[] finished = new int[1];
clearLocalDevices();
for (int type : deviceTypes) {
final HdmiCecLocalDevice localDevice = HdmiCecLocalDevice.create(this, type);
@@ -309,14 +323,11 @@
mCecController.addLogicalAddress(logicalAddress);
devices.append(logicalAddress, localDevice);
}
- finished.append(deviceType, logicalAddress);
// Address allocation completed for all devices. Notify each device.
- if (deviceTypes.size() == finished.size()) {
- if (mPowerStatus == HdmiControlManager.POWER_STATUS_TRANSIENT_TO_ON) {
- mPowerStatus = HdmiControlManager.POWER_STATUS_ON;
- }
- notifyAddressAllocated(devices, fromBootup);
+ if (deviceTypes.size() == ++finished[0]) {
+ onInitializeCecComplete();
+ notifyAddressAllocated(devices, initiatedBy);
}
}
});
@@ -324,15 +335,13 @@
}
@ServiceThreadOnly
- private void notifyAddressAllocated(SparseArray<HdmiCecLocalDevice> devices,
- boolean fromBootup) {
+ private void notifyAddressAllocated(SparseArray<HdmiCecLocalDevice> devices, int initiatedBy) {
assertRunOnServiceThread();
for (int i = 0; i < devices.size(); ++i) {
int address = devices.keyAt(i);
HdmiCecLocalDevice device = devices.valueAt(i);
- device.handleAddressAllocated(address, fromBootup);
+ device.handleAddressAllocated(address, initiatedBy);
}
- onInitializeCecComplete();
}
// Initialize HDMI port information. Combine the information from CEC and MHL HAL and
@@ -523,6 +532,18 @@
mCecController.sendCommand(command, null);
}
+ /**
+ * Send <Feature Abort> command on the given CEC message if possible.
+ * If the aborted message is invalid, then it wont send the message.
+ * @param command original command to be aborted
+ * @param reason reason of feature abort
+ */
+ @ServiceThreadOnly
+ void maySendFeatureAbortCommand(HdmiCecMessage command, int reason) {
+ assertRunOnServiceThread();
+ mCecController.maySendFeatureAbortCommand(command, reason);
+ }
+
@ServiceThreadOnly
boolean handleCecCommand(HdmiCecMessage message) {
assertRunOnServiceThread();
@@ -1412,6 +1433,7 @@
@ServiceThreadOnly
void wakeUp() {
assertRunOnServiceThread();
+ mWakeUpMessageReceived = true;
PowerManager pm = (PowerManager) getContext().getSystemService(Context.POWER_SERVICE);
pm.wakeUp(SystemClock.uptimeMillis());
// PowerManger will send the broadcast Intent.ACTION_SCREEN_ON and after this gets
@@ -1434,7 +1456,11 @@
mPowerStatus = HdmiControlManager.POWER_STATUS_TRANSIENT_TO_ON;
if (mCecController != null) {
if (mHdmiControlEnabled) {
- initializeCec(true);
+ int startReason = INITIATED_BY_SCREEN_ON;
+ if (mWakeUpMessageReceived) {
+ startReason = INITIATED_BY_WAKE_UP_MESSAGE;
+ }
+ initializeCec(startReason);
}
} else {
Slog.i(TAG, "Device does not support HDMI-CEC.");
@@ -1551,7 +1577,7 @@
}
if (enabled) {
- initializeCec(false);
+ initializeCec(INITIATED_BY_ENABLE_CEC);
} else {
disableDevices(new PendingActionClearedCallback() {
@Override
diff --git a/services/core/java/com/android/server/hdmi/TimerRecordingAction.java b/services/core/java/com/android/server/hdmi/TimerRecordingAction.java
index 0275853..1a179e6 100644
--- a/services/core/java/com/android/server/hdmi/TimerRecordingAction.java
+++ b/services/core/java/com/android/server/hdmi/TimerRecordingAction.java
@@ -83,11 +83,13 @@
@Override
public void onSendCompleted(int error) {
if (error != Constants.SEND_RESULT_SUCCESS) {
- mState = STATE_WAITING_FOR_TIMER_STATUS;
- addTimer(mState, TIMER_STATUS_TIMEOUT_MS);
+ tv().announceTimerRecordingResult(
+ TIMER_RECORDING_RESULT_EXTRA_CHECK_RECORDER_CONNECTION);
finish();
return;
}
+ mState = STATE_WAITING_FOR_TIMER_STATUS;
+ addTimer(mState, TIMER_STATUS_TIMEOUT_MS);
}
});
}
@@ -128,7 +130,7 @@
private boolean handleFeatureAbort(HdmiCecMessage cmd) {
byte[] params = cmd.getParams();
- int messageType = params[0];
+ int messageType = params[0] & 0xFF;
switch (messageType) {
case Constants.MESSAGE_SET_DIGITAL_TIMER: // fall through
case Constants.MESSAGE_SET_ANALOG_TIMER: // fall through
@@ -137,7 +139,7 @@
default:
return false;
}
- int reason = params[1];
+ int reason = params[1] & 0xFF;
Slog.i(TAG, "[Feature Abort] for " + messageType + " reason:" + reason);
tv().announceTimerRecordingResult(TIMER_RECORDING_RESULT_EXTRA_CHECK_RECORDER_CONNECTION);
finish();
diff --git a/services/core/java/com/android/server/tv/TvInputHardwareManager.java b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
index 4d375ee..ba79fed 100644
--- a/services/core/java/com/android/server/tv/TvInputHardwareManager.java
+++ b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
@@ -29,6 +29,8 @@
import android.hardware.hdmi.IHdmiInputChangeListener;
import android.media.AudioDevicePort;
import android.media.AudioFormat;
+import android.media.AudioGain;
+import android.media.AudioGainConfig;
import android.media.AudioManager;
import android.media.AudioPatch;
import android.media.AudioPort;
@@ -55,6 +57,7 @@
import com.android.server.SystemService;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
@@ -559,6 +562,8 @@
private final AudioDevicePort mAudioSource;
private AudioDevicePort mAudioSink;
private AudioPatch mAudioPatch = null;
+ private float mCommittedVolume = 0.0f;
+ private float mVolume = 0.0f;
private TvStreamConfig mActiveConfig = null;
@@ -663,9 +668,42 @@
}
private void updateAudioPatchLocked() {
+ AudioGainConfig sourceGainConfig = null;
+ if (mAudioSource.gains().length > 0 && mVolume != mCommittedVolume) {
+ AudioGain sourceGain = null;
+ for (AudioGain gain : mAudioSource.gains()) {
+ if ((gain.mode() & AudioGain.MODE_JOINT) != 0) {
+ sourceGain = gain;
+ break;
+ }
+ }
+ // NOTE: we only change the source gain in MODE_JOINT here.
+ if (sourceGain != null) {
+ int steps = (sourceGain.maxValue() - sourceGain.minValue())
+ / sourceGain.stepValue();
+ int gainValue = sourceGain.minValue();
+ if (mVolume < 1.0f) {
+ gainValue += sourceGain.stepValue() * (int) (mVolume * steps + 0.5);
+ } else {
+ gainValue = sourceGain.maxValue();
+ }
+ int numChannels = 0;
+ for (int mask = sourceGain.channelMask(); mask > 0; mask >>= 1) {
+ numChannels += (mask & 1);
+ }
+ int[] gainValues = new int[numChannels];
+ Arrays.fill(gainValues, gainValue);
+ sourceGainConfig = sourceGain.buildConfig(AudioGain.MODE_JOINT,
+ sourceGain.channelMask(), gainValues, 0);
+ } else {
+ Slog.w(TAG, "No audio source gain with MODE_JOINT support exists.");
+ }
+ }
+
AudioPortConfig sourceConfig = mAudioSource.activeConfig();
AudioPortConfig sinkConfig = mAudioSink.activeConfig();
AudioPatch[] audioPatchArray = new AudioPatch[] { mAudioPatch };
+ boolean shouldRecreateAudioPatch = false;
if (sinkConfig == null
|| (mDesiredSamplingRate != 0
&& sinkConfig.samplingRate() != mDesiredSamplingRate)
@@ -675,26 +713,32 @@
&& sinkConfig.format() != mDesiredFormat)) {
sinkConfig = mAudioSource.buildConfig(mDesiredSamplingRate, mDesiredChannelMask,
mDesiredFormat, null);
+ shouldRecreateAudioPatch = true;
}
- if (sourceConfig == null) {
+ if (sourceConfig == null || sourceGainConfig != null) {
sourceConfig = mAudioSource.buildConfig(sinkConfig.samplingRate(),
- sinkConfig.channelMask(), sinkConfig.format(), null);
+ sinkConfig.channelMask(), sinkConfig.format(), sourceGainConfig);
+ shouldRecreateAudioPatch = true;
}
- mAudioManager.createAudioPatch(
- audioPatchArray,
- new AudioPortConfig[] { sourceConfig },
- new AudioPortConfig[] { sinkConfig });
- mAudioPatch = audioPatchArray[0];
+ if (shouldRecreateAudioPatch) {
+ mCommittedVolume = mVolume;
+ mAudioManager.createAudioPatch(
+ audioPatchArray,
+ new AudioPortConfig[] { sourceConfig },
+ new AudioPortConfig[] { sinkConfig });
+ mAudioPatch = audioPatchArray[0];
+ }
}
@Override
- public void setVolume(float volume) throws RemoteException {
+ public void setStreamVolume(float volume) throws RemoteException {
synchronized (mImplLock) {
if (mReleased) {
throw new IllegalStateException("Device already released.");
}
+ mVolume = volume;
+ updateAudioPatchLocked();
}
- // TODO: Use AudioGain?
}
@Override
diff --git a/services/core/jni/com_android_server_tv_TvInputHal.cpp b/services/core/jni/com_android_server_tv_TvInputHal.cpp
index 5eb627b..d5abe0c 100644
--- a/services/core/jni/com_android_server_tv_TvInputHal.cpp
+++ b/services/core/jni/com_android_server_tv_TvInputHal.cpp
@@ -400,18 +400,15 @@
connection.mSurface->setSidebandStream(NULL);
connection.mSurface.clear();
}
+ if (connection.mThread != NULL) {
+ connection.mThread->shutdown();
+ connection.mThread.clear();
+ }
+ if (mDevice->close_stream(mDevice, deviceId, streamId) != 0) {
+ ALOGE("Couldn't remove stream");
+ return BAD_VALUE;
+ }
if (connection.mSourceHandle != NULL) {
- // Need to reset streams
- if (mDevice->close_stream(mDevice, deviceId, streamId) != 0) {
- ALOGE("Couldn't remove stream");
- return BAD_VALUE;
- }
-
- // Clear everything
- if (connection.mThread != NULL) {
- connection.mThread->shutdown();
- connection.mThread.clear();
- }
connection.mSourceHandle.clear();
}
return NO_ERROR;