Merge "Add missing annotations, getters to GradientDrawable" into nyc-dev
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index 2c270fc..7a69c62 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -61,7 +61,7 @@
StatusBarNotification[] getActiveNotifications(String callingPkg);
StatusBarNotification[] getHistoricalNotifications(String callingPkg, int count);
- void registerListener(in INotificationListener listener, in ComponentName component, int userid, boolean asRanker);
+ void registerListener(in INotificationListener listener, in ComponentName component, int userid);
void unregisterListener(in INotificationListener listener, int userid);
void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 7cfa0cd..10aa7eb 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -145,7 +145,6 @@
public static final String ACTION_INTERRUPTION_FILTER_CHANGED_INTERNAL
= "android.app.action.INTERRUPTION_FILTER_CHANGED_INTERNAL";
-
/** @hide */
@IntDef({INTERRUPTION_FILTER_NONE, INTERRUPTION_FILTER_PRIORITY, INTERRUPTION_FILTER_ALARMS,
INTERRUPTION_FILTER_ALL, INTERRUPTION_FILTER_UNKNOWN})
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index a8b8da1..afdd1d4 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -680,18 +680,12 @@
@SystemApi
public void registerAsSystemService(Context context, ComponentName componentName,
int currentUser) throws RemoteException {
- registerAsSystemServiceImpl(context, componentName, currentUser, false /* asRanker */);
- }
-
- /** @hide */
- protected void registerAsSystemServiceImpl(Context context, ComponentName componentName,
- int currentUser, boolean asRanker) throws RemoteException {
- mSystemContext = context;
if (mWrapper == null) {
mWrapper = new NotificationListenerWrapper();
}
+ mSystemContext = context;
INotificationManager noMan = getNotificationInterface();
- noMan.registerListener(mWrapper, componentName, currentUser, asRanker);
+ noMan.registerListener(mWrapper, componentName, currentUser);
mCurrentUser = currentUser;
mHandler = new MyHandler(context.getMainLooper());
}
diff --git a/core/java/android/service/notification/NotificationRankerService.java b/core/java/android/service/notification/NotificationRankerService.java
index 520b4c2..e325354 100644
--- a/core/java/android/service/notification/NotificationRankerService.java
+++ b/core/java/android/service/notification/NotificationRankerService.java
@@ -37,7 +37,7 @@
*/
@SystemApi
public abstract class NotificationRankerService extends NotificationListenerService {
- private static final String TAG = "NotificationRanker";
+ private static final String TAG = "NotificationRankers";
/**
* The {@link Intent} that must be declared as handled by the service.
@@ -118,9 +118,8 @@
/** @hide */
@Override
public void registerAsSystemService(Context context, ComponentName componentName,
- int currentUser) throws RemoteException {
- registerAsSystemServiceImpl(context, componentName, currentUser, true /* as Ranker */);
- mHandler = new MyHandler(getContext().getMainLooper());
+ int currentUser) {
+ throw new IllegalStateException("the ranker may not start itself.");
}
@Override
diff --git a/core/java/android/widget/DayPickerPagerAdapter.java b/core/java/android/widget/DayPickerPagerAdapter.java
index f5840dc..8ce2f9c 100644
--- a/core/java/android/widget/DayPickerPagerAdapter.java
+++ b/core/java/android/widget/DayPickerPagerAdapter.java
@@ -282,7 +282,7 @@
public CharSequence getPageTitle(int position) {
final SimpleMonthView v = mItems.get(position).calendar;
if (v != null) {
- return v.getTitle();
+ return v.getMonthYearLabel();
}
return null;
}
diff --git a/core/java/android/widget/SimpleMonthView.java b/core/java/android/widget/SimpleMonthView.java
index 6edce91..8a7ce12 100644
--- a/core/java/android/widget/SimpleMonthView.java
+++ b/core/java/android/widget/SimpleMonthView.java
@@ -47,6 +47,7 @@
import com.android.internal.widget.ExploreByTouchHelper;
import java.text.NumberFormat;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Locale;
@@ -55,13 +56,15 @@
* within the specified month.
*/
class SimpleMonthView extends View {
+ private static final String LOG_TAG = "SimpleMonthView";
+
private static final int DAYS_IN_WEEK = 7;
private static final int MAX_WEEKS_IN_MONTH = 6;
private static final int DEFAULT_SELECTED_DAY = -1;
private static final int DEFAULT_WEEK_START = Calendar.SUNDAY;
- private static final String DEFAULT_TITLE_FORMAT = "MMMMy";
+ private static final String MONTH_YEAR_FORMAT = "MMMMy";
private static final String DAY_OF_WEEK_FORMAT = "EEEEE";
private static final int SELECTED_HIGHLIGHT_ALPHA = 0xB0;
@@ -73,13 +76,13 @@
private final Paint mDayHighlightPaint = new Paint();
private final Paint mDayHighlightSelectorPaint = new Paint();
- private final Calendar mCalendar = Calendar.getInstance();
- private final Calendar mDayOfWeekLabelCalendar = Calendar.getInstance();
+ private final String[] mDayOfWeekLabels = new String[7];
+
+ private final Calendar mCalendar;
+ private final Locale mLocale;
private final MonthViewTouchHelper mTouchHelper;
- private final SimpleDateFormat mTitleFormatter;
- private final SimpleDateFormat mDayOfWeekFormatter;
private final NumberFormat mDayFormatter;
// Desired dimensions.
@@ -89,7 +92,7 @@
private final int mDesiredCellWidth;
private final int mDesiredDaySelectorRadius;
- private CharSequence mTitle;
+ private String mMonthYearLabel;
private int mMonth;
private int mYear;
@@ -168,15 +171,34 @@
setAccessibilityDelegate(mTouchHelper);
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
- final Locale locale = res.getConfiguration().locale;
- final String titleFormat = DateFormat.getBestDateTimePattern(locale, DEFAULT_TITLE_FORMAT);
- mTitleFormatter = new SimpleDateFormat(titleFormat, locale);
- mDayOfWeekFormatter = new SimpleDateFormat(DAY_OF_WEEK_FORMAT, locale);
- mDayFormatter = NumberFormat.getIntegerInstance(locale);
+ mLocale = res.getConfiguration().locale;
+ mCalendar = Calendar.getInstance(mLocale);
+
+ mDayFormatter = NumberFormat.getIntegerInstance(mLocale);
+
+ updateMonthYearLabel();
+ updateDayOfWeekLabels();
initPaints(res);
}
+ private void updateMonthYearLabel() {
+ final String format = DateFormat.getBestDateTimePattern(mLocale, MONTH_YEAR_FORMAT);
+ final SimpleDateFormat formatter = new SimpleDateFormat(format, mLocale);
+ mMonthYearLabel = formatter.format(mCalendar.getTime());
+ }
+
+ private void updateDayOfWeekLabels() {
+ final Calendar calendar = Calendar.getInstance(mLocale);
+ calendar.setFirstDayOfWeek(mWeekStart);
+
+ final SimpleDateFormat formatter = new SimpleDateFormat(DAY_OF_WEEK_FORMAT, mLocale);
+ for (int i = 0; i < 7; i++) {
+ calendar.set(Calendar.DAY_OF_WEEK, i);
+ mDayOfWeekLabels[i] = formatter.format(calendar.getTime());
+ }
+ }
+
/**
* Applies the specified text appearance resource to a paint, returning the
* text color if one is set in the text appearance.
@@ -236,13 +258,6 @@
invalidate();
}
- public CharSequence getTitle() {
- if (mTitle == null) {
- mTitle = mTitleFormatter.format(mCalendar.getTime());
- }
- return mTitle;
- }
-
/**
* Sets up the text and style properties for painting.
*/
@@ -607,7 +622,11 @@
final float lineHeight = mMonthPaint.ascent() + mMonthPaint.descent();
final float y = (mMonthHeight - lineHeight) / 2f;
- canvas.drawText(getTitle().toString(), x, y, mMonthPaint);
+ canvas.drawText(mMonthYearLabel, x, y, mMonthPaint);
+ }
+
+ public String getMonthYearLabel() {
+ return mMonthYearLabel;
}
private void drawDaysOfWeek(Canvas canvas) {
@@ -630,16 +649,11 @@
}
final int dayOfWeek = (col + mWeekStart) % DAYS_IN_WEEK;
- final String label = getDayOfWeekLabel(dayOfWeek);
+ final String label = mDayOfWeekLabels[dayOfWeek];
canvas.drawText(label, colCenterRtl, rowCenter - halfLineHeight, p);
}
}
- private String getDayOfWeekLabel(int dayOfWeek) {
- mDayOfWeekLabelCalendar.set(Calendar.DAY_OF_WEEK, dayOfWeek);
- return mDayOfWeekFormatter.format(mDayOfWeekLabelCalendar.getTime());
- }
-
/**
* Draws the month days.
*/
@@ -752,6 +766,8 @@
mWeekStart = mCalendar.getFirstDayOfWeek();
}
+ updateDayOfWeekLabels();
+
// Invalidate cached accessibility information.
mTouchHelper.invalidateRoot();
invalidate();
@@ -807,11 +823,10 @@
mEnabledDayStart = MathUtils.constrain(enabledDayStart, 1, mDaysInMonth);
mEnabledDayEnd = MathUtils.constrain(enabledDayEnd, mEnabledDayStart, mDaysInMonth);
- // Invalidate the old title.
- mTitle = null;
-
// Invalidate cached accessibility information.
mTouchHelper.invalidateRoot();
+
+ updateMonthYearLabel();
}
private static int getDaysInMonth(int month, int year) {
diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
index ca214ab..219bca8 100644
--- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
@@ -35,6 +35,7 @@
import android.graphics.ColorFilter;
import android.graphics.Insets;
import android.graphics.Outline;
+import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.os.Build;
@@ -307,7 +308,7 @@
@Override
public int getOpacity() {
- return mAnimatedVectorState.mVectorDrawable.getOpacity();
+ return PixelFormat.TRANSLUCENT;
}
@Override
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index 9e0f1b4..44a91fe 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -364,7 +364,9 @@
@Override
public int getOpacity() {
- return PixelFormat.TRANSLUCENT;
+ // We can't tell whether the drawable is fully opaque unless we examine all the pixels,
+ // but we could tell it is transparent if the root alpha is 0.
+ return getAlpha() == 0 ? PixelFormat.TRANSPARENT : PixelFormat.TRANSLUCENT;
}
@Override
diff --git a/packages/DocumentsUI/res/color/item_details.xml b/packages/DocumentsUI/res/color/item_details.xml
new file mode 100644
index 0000000..769b944
--- /dev/null
+++ b/packages/DocumentsUI/res/color/item_details.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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:color="?android:attr/textColorPrimary"
+ android:alpha="0.63" />
+ <item
+ android:state_enabled="false"
+ android:color="?android:attr/textColorPrimary"
+ android:alpha="0.3" />
+</selector>
diff --git a/packages/DocumentsUI/res/color/item_title.xml b/packages/DocumentsUI/res/color/item_title.xml
new file mode 100644
index 0000000..ef6aea3
--- /dev/null
+++ b/packages/DocumentsUI/res/color/item_title.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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:color="?android:attr/textColorPrimary" />
+ <item
+ android:state_enabled="false"
+ android:color="?android:attr/textColorPrimary"
+ android:alpha="0.3" />
+</selector>
diff --git a/packages/DocumentsUI/res/layout/item_dir_grid.xml b/packages/DocumentsUI/res/layout/item_dir_grid.xml
index a4f06d1..429a972 100644
--- a/packages/DocumentsUI/res/layout/item_dir_grid.xml
+++ b/packages/DocumentsUI/res/layout/item_dir_grid.xml
@@ -66,7 +66,7 @@
android:singleLine="true"
android:textAlignment="viewStart"
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
- android:textColor="@*android:color/primary_text_default_material_light" />
+ android:textColor="@color/item_title" />
</LinearLayout>
diff --git a/packages/DocumentsUI/res/layout/item_doc_grid.xml b/packages/DocumentsUI/res/layout/item_doc_grid.xml
index af1703f..56a061f 100644
--- a/packages/DocumentsUI/res/layout/item_doc_grid.xml
+++ b/packages/DocumentsUI/res/layout/item_doc_grid.xml
@@ -93,7 +93,7 @@
android:ellipsize="end"
android:textAlignment="viewStart"
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
- android:textColor="@*android:color/primary_text_default_material_light" />
+ android:textColor="@color/item_title" />
<TextView
android:id="@+id/size"
@@ -106,7 +106,7 @@
android:ellipsize="end"
android:textAlignment="viewStart"
android:textAppearance="@android:style/TextAppearance.Material.Caption"
- android:textColor="@*android:color/primary_text_default_material_light" />
+ android:textColor="@color/item_details" />
<TextView
android:id="@+id/date"
@@ -118,7 +118,7 @@
android:ellipsize="end"
android:textAlignment="viewStart"
android:textAppearance="@android:style/TextAppearance.Material.Caption"
- android:textColor="@*android:color/primary_text_default_material_light" />
+ android:textColor="@color/item_details" />
</RelativeLayout>
diff --git a/packages/DocumentsUI/res/layout/item_doc_list.xml b/packages/DocumentsUI/res/layout/item_doc_list.xml
index 29f65e09..a939fcd 100644
--- a/packages/DocumentsUI/res/layout/item_doc_list.xml
+++ b/packages/DocumentsUI/res/layout/item_doc_list.xml
@@ -85,7 +85,7 @@
android:singleLine="true"
android:textAlignment="viewStart"
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
- android:textColor="?android:attr/textColorPrimary" />
+ android:textColor="@color/item_title" />
<LinearLayout
android:id="@+id/line2"
@@ -102,8 +102,8 @@
android:ellipsize="end"
android:singleLine="true"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
- android:textColor="?android:attr/textColorSecondary" />
+ android:textAppearance="@android:style/TextAppearance.Material.Caption"
+ android:textColor="@color/item_details" />
<TextView
android:id="@+id/size"
@@ -113,8 +113,8 @@
android:ellipsize="end"
android:singleLine="true"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
- android:textColor="?android:attr/textColorSecondary" />
+ android:textAppearance="@android:style/TextAppearance.Material.Caption"
+ android:textColor="@color/item_details" />
<TextView
android:id="@android:id/summary"
@@ -125,8 +125,8 @@
android:ellipsize="end"
android:singleLine="true"
android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
- android:textColor="?android:attr/textColorSecondary" />
+ android:textAppearance="@android:style/TextAppearance.Material.Caption"
+ android:textColor="@color/item_details" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
diff --git a/packages/DocumentsUI/res/values-sw720dp-land/config.xml b/packages/DocumentsUI/res/values-sw720dp-land/config.xml
index 8d9526d..6893d7a 100644
--- a/packages/DocumentsUI/res/values-sw720dp-land/config.xml
+++ b/packages/DocumentsUI/res/values-sw720dp-land/config.xml
@@ -15,5 +15,4 @@
-->
<resources>
- <bool name="always_show_summary">true</bool>
</resources>
diff --git a/packages/DocumentsUI/res/values/colors.xml b/packages/DocumentsUI/res/values/colors.xml
index 3785adf..04b7fee 100644
--- a/packages/DocumentsUI/res/values/colors.xml
+++ b/packages/DocumentsUI/res/values/colors.xml
@@ -23,8 +23,6 @@
<color name="window_background">#fff1f1f1</color>
<color name="drawer_background">#fff1f1f1</color>
<color name="directory_background">#fff7f7f7</color>
- <color name="item_doc_background">#fffafafa</color>
- <color name="item_doc_background_selected">#ffe0f2f1</color>
<color name="menu_search_background">#ff676f74</color>
<color name="primary_dark">@*android:color/primary_dark_material_dark</color>
@@ -35,4 +33,11 @@
<color name="band_select_background">#88ffffff</color>
<color name="band_select_border">#44000000</color>
+
+ <color name="item_doc_background_disabled">#fff4f4f4</color>
+
+ <!-- TODO: Would be nice to move this to a color-set, but not sure how to support animation -->
+ <color name="item_doc_background">#fffafafa</color>
+ <color name="item_doc_background_selected">#ffe0f2f1</color>
+
</resources>
diff --git a/packages/DocumentsUI/res/values/config.xml b/packages/DocumentsUI/res/values/config.xml
index 8a76540..86087c3 100644
--- a/packages/DocumentsUI/res/values/config.xml
+++ b/packages/DocumentsUI/res/values/config.xml
@@ -21,5 +21,4 @@
<!-- Intentionally unset. Vendors should set this in an overlay. -->
<string name="trusted_quick_viewer_package" translatable="false"></string>
<bool name="list_divider_inset_left">true</bool>
- <bool name="always_show_summary">false</bool>
</resources>
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DocumentHolder.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DocumentHolder.java
index 3b5ce87..5edda38 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DocumentHolder.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DocumentHolder.java
@@ -16,6 +16,7 @@
package com.android.documentsui.dirlist;
+import android.annotation.ColorInt;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Rect;
@@ -35,17 +36,19 @@
extends RecyclerView.ViewHolder
implements View.OnKeyListener {
+ static final float DISABLED_ALPHA = 0.3f;
+
public @Nullable String modelId;
- final int mSelectedItemColor;
- final int mDefaultItemColor;
- final boolean mAlwaysShowSummary;
final Context mContext;
+ final @ColorInt int mDefaultBgColor;
+ final @ColorInt int mSelectedBgColor;
DocumentHolder.EventListener mEventListener;
private View.OnKeyListener mKeyListener;
private View mSelectionHotspot;
+
public DocumentHolder(Context context, ViewGroup parent, int layout) {
this(context, inflateLayout(context, parent, layout));
}
@@ -57,9 +60,8 @@
mContext = context;
- mDefaultItemColor = context.getColor(R.color.item_doc_background);
- mSelectedItemColor = context.getColor(R.color.item_doc_background_selected);
- mAlwaysShowSummary = context.getResources().getBoolean(R.bool.always_show_summary);
+ mDefaultBgColor = context.getColor(R.color.item_doc_background);
+ mSelectedBgColor = context.getColor(R.color.item_doc_background_selected);
mSelectionHotspot = itemView.findViewById(R.id.icon_check);
}
@@ -80,7 +82,7 @@
*/
public void setSelected(boolean selected) {
itemView.setActivated(selected);
- itemView.setBackgroundColor(selected ? mSelectedItemColor : mDefaultItemColor);
+ itemView.setBackgroundColor(selected ? mSelectedBgColor : mDefaultBgColor);
}
/**
@@ -88,7 +90,11 @@
* @param highlighted
*/
public void setHighlighted(boolean highlighted) {
- itemView.setBackgroundColor(highlighted ? mSelectedItemColor : mDefaultItemColor);
+ itemView.setBackgroundColor(highlighted ? mSelectedBgColor : mDefaultBgColor);
+ }
+
+ public void setEnabled(boolean enabled) {
+ setEnabledRecursive(itemView, enabled);
}
@Override
@@ -111,10 +117,6 @@
mKeyListener = listener;
}
- public void setEnabled(boolean enabled) {
- setEnabledRecursive(itemView, enabled);
- }
-
public boolean onSingleTapUp(MotionEvent event) {
if (Events.isMouseEvent(event)) {
// Mouse clicks select.
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/GridDocumentHolder.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/GridDocumentHolder.java
index a4bce16..e7fa28b 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/GridDocumentHolder.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/GridDocumentHolder.java
@@ -20,6 +20,7 @@
import static com.android.documentsui.model.DocumentInfo.getCursorLong;
import static com.android.documentsui.model.DocumentInfo.getCursorString;
+import android.annotation.ColorInt;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
@@ -37,6 +38,7 @@
import com.android.documentsui.State;
final class GridDocumentHolder extends DocumentHolder {
+
private static boolean mHideTitles;
final TextView mTitle;
@@ -48,9 +50,13 @@
final ImageView mIconCheck;
final IconHelper mIconHelper;
+ private final @ColorInt int mDisabledBgColor;
+
public GridDocumentHolder(Context context, ViewGroup parent, IconHelper iconHelper) {
super(context, parent, R.layout.item_doc_grid);
+ mDisabledBgColor = context.getColor(R.color.item_doc_background_disabled);
+
mTitle = (TextView) itemView.findViewById(android.R.id.title);
mDate = (TextView) itemView.findViewById(R.id.date);
mSize = (TextView) itemView.findViewById(R.id.size);
@@ -64,13 +70,35 @@
@Override
public void setSelected(boolean selected) {
- super.setSelected(selected);
+ // We always want to make sure our check box disappears if we're not selected,
+ // even if the item is disabled. This is because this object can be reused
+ // and this method will be called to setup initial state.
float checkAlpha = selected ? 1f : 0f;
-
mIconCheck.animate().alpha(checkAlpha).start();
+
+ // But it should be an error to be set to selected && be disabled.
+ if (!itemView.isEnabled()) {
+ assert(!selected);
+ return;
+ }
+
+ super.setSelected(selected);
+
mIconMimeSm.animate().alpha(1f - checkAlpha).start();
}
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+
+ // Text colors enabled/disabled is handle via a color set.
+ itemView.setBackgroundColor(enabled ? mDefaultBgColor : mDisabledBgColor);
+ float imgAlpha = enabled ? 1f : DISABLED_ALPHA;
+
+ mIconMimeLg.setAlpha(imgAlpha);
+ mIconMimeSm.setAlpha(imgAlpha);
+ mIconThumb.setAlpha(imgAlpha);
+ }
+
/**
* Bind this view to the given document for display.
* @param cursor Pointing to the item to be bound.
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/ListDocumentHolder.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/ListDocumentHolder.java
index 0831dbf..3a1be11 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/ListDocumentHolder.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/ListDocumentHolder.java
@@ -66,14 +66,33 @@
@Override
public void setSelected(boolean selected) {
- super.setSelected(selected);
+ // We always want to make sure our check box disappears if we're not selected,
+ // even if the item is disabled. But it should be an error (see assert below)
+ // to be set to selected && be disabled.
float checkAlpha = selected ? 1f : 0f;
-
mIconCheck.animate().alpha(checkAlpha).start();
+
+ if (!itemView.isEnabled()) {
+ assert(!selected);
+ return;
+ }
+
+ super.setSelected(selected);
+
mIconMime.animate().alpha(1f - checkAlpha).start();
mIconThumb.animate().alpha(1f - checkAlpha).start();
}
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+
+ // Text colors enabled/disabled is handle via a color set.
+ final float imgAlpha = enabled ? 1f : DISABLED_ALPHA;
+ mIconMime.setAlpha(imgAlpha);
+ mIconThumb.setAlpha(imgAlpha);
+ }
+
/**
* Bind this view to the given document for display.
* @param cursor Pointing to the item to be bound.
@@ -145,12 +164,4 @@
mDetails.setVisibility(hasDetails ? View.VISIBLE : View.GONE);
}
}
-
- @Override
- public void setEnabled(boolean enabled) {
- super.setEnabled(enabled);
- final float iconAlpha = enabled ? 1f : 0.5f;
- mIconMime.setAlpha(iconAlpha);
- mIconThumb.setAlpha(iconAlpha);
- }
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/ModelBackedDocumentsAdapter.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/ModelBackedDocumentsAdapter.java
index 2b07339..a8b762b 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/ModelBackedDocumentsAdapter.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/ModelBackedDocumentsAdapter.java
@@ -118,8 +118,13 @@
final String docMimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE);
final int docFlags = getCursorInt(cursor, Document.COLUMN_FLAGS);
+ boolean enabled = mEnv.isDocumentEnabled(docMimeType, docFlags);
+ boolean selected = mEnv.isSelected(modelId);
+ if (!enabled) {
+ assert(!selected);
+ }
+ holder.setEnabled(enabled);
holder.setSelected(mEnv.isSelected(modelId));
- holder.setEnabled(mEnv.isDocumentEnabled(docMimeType, docFlags));
mEnv.onBindDocumentHolder(holder, cursor);
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/services/MoveJob.java b/packages/DocumentsUI/src/com/android/documentsui/services/MoveJob.java
index dc39235..f1b4681 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/services/MoveJob.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/services/MoveJob.java
@@ -68,7 +68,7 @@
@Override
public Notification getProgressNotification() {
- return getProgressNotification(R.string.copy_preparing);
+ return getProgressNotification(R.string.copy_remaining);
}
@Override
diff --git a/packages/ExtServices/AndroidManifest.xml b/packages/ExtServices/AndroidManifest.xml
index 100b35c..519db66 100644
--- a/packages/ExtServices/AndroidManifest.xml
+++ b/packages/ExtServices/AndroidManifest.xml
@@ -15,18 +15,27 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
package="android.ext.services"
android:versionCode="1"
android:versionName="1"
coreApp="true">
<application android:label="@string/app_name"
- android:allowBackup="false"
android:forceDeviceEncrypted="true"
android:encryptionAware="true">
<library android:name="android.ext.services"/>
+ <service android:name=".notification.Ranker"
+ android:label="@string/notification_ranker"
+ android:permission="android.permission.BIND_NOTIFICATION_RANKER_SERVICE"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.service.notification.NotificationRankerService" />
+ </intent-filter>
+ </service>
+
</application>
</manifest>
diff --git a/packages/ExtServices/res/values/strings.xml b/packages/ExtServices/res/values/strings.xml
index 531e517..0763403 100644
--- a/packages/ExtServices/res/values/strings.xml
+++ b/packages/ExtServices/res/values/strings.xml
@@ -16,4 +16,5 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">Android Services Library</string>
+ <string name="notification_ranker">Android Notification Ranking Service</string>
</resources>
diff --git a/packages/ExtServices/src/android/ext/services/notification/Ranker.java b/packages/ExtServices/src/android/ext/services/notification/Ranker.java
new file mode 100644
index 0000000..0b2b1a4
--- /dev/null
+++ b/packages/ExtServices/src/android/ext/services/notification/Ranker.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016 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 android.ext.services.notification;
+
+import android.service.notification.NotificationRankerService;
+import android.service.notification.StatusBarNotification;
+import android.util.Log;
+
+/**
+ * Class that provides an updatable ranker module for the notification manager..
+ */
+public final class Ranker extends NotificationRankerService {
+ private static final String TAG = "RocketRanker";
+ private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);;
+
+ @Override
+ public Adjustment onNotificationEnqueued(StatusBarNotification sbn, int importance,
+ boolean user) {
+ if (DEBUG) Log.i(TAG, "ENQUEUED " + sbn.getKey());
+ return null;
+ }
+
+ @Override
+ public void onNotificationPosted(StatusBarNotification sbn) {
+ if (DEBUG) Log.i(TAG, "POSTED " + sbn.getKey());
+ }
+
+ @Override
+ public void onListenerConnected() {
+ if (DEBUG) Log.i(TAG, "CONNECTED");
+ }
+}
\ No newline at end of file
diff --git a/packages/SettingsLib/res/layout/restricted_icon.xml b/packages/SettingsLib/res/layout/restricted_icon.xml
index d57fb80..724a524 100644
--- a/packages/SettingsLib/res/layout/restricted_icon.xml
+++ b/packages/SettingsLib/res/layout/restricted_icon.xml
@@ -17,5 +17,4 @@
android:id="@+id/restricted_icon"
android:layout_width="@dimen/restricted_icon_size"
android:layout_height="@dimen/restricted_icon_size"
- android:src="@drawable/ic_info"
- android:gravity="end|center_vertical" />
\ No newline at end of file
+ android:src="@drawable/ic_info" />
\ No newline at end of file
diff --git a/packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java b/packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java
index bace4c0..62c213a 100644
--- a/packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java
+++ b/packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java
@@ -22,9 +22,6 @@
import android.os.UserHandle;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceViewHolder;
-import android.text.Spanned;
-import android.text.SpannableStringBuilder;
-import android.text.style.ImageSpan;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
@@ -39,8 +36,6 @@
public class RestrictedPreferenceHelper {
private final Context mContext;
private final Preference mPreference;
- private final Drawable mRestrictedPadlock;
- private final int mRestrictedPadlockPadding;
private boolean mDisabledByAdmin;
private EnforcedAdmin mEnforcedAdmin;
@@ -52,10 +47,6 @@
mContext = context;
mPreference = preference;
- mRestrictedPadlock = RestrictedLockUtils.getRestrictedPadlock(mContext);
- mRestrictedPadlockPadding = mContext.getResources().getDimensionPixelSize(
- R.dimen.restricted_icon_padding);
-
if (attrs != null) {
final TypedArray attributes = context.obtainStyledAttributes(attrs,
R.styleable.RestrictedPreference);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
index c8c71cb..3d455993 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
@@ -138,6 +138,7 @@
firstPageBuilder.setListener(this);
// Fade in the tiles/labels as we reach the final position.
firstPageDelayedBuilder.addFloat(mQsPanel.getTileLayout(), "alpha", 0, 1);
+ clearAnimationState();
mAllViews.clear();
mTopFiveQs.clear();
mAllViews.add((View) mQsPanel.getTileLayout());
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java
index ad70853..284c309 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityGestureDetector.java
@@ -121,9 +121,9 @@
// movement when gesturing, and touch exploring. Based on user testing,
// all gestures started with the initial movement taking less than 100ms.
// When touch exploring, the first movement almost always takes longer than
- // 200ms. From this data, 150ms seems the best value to decide what
+ // 200ms. From this data, 200ms seems the best value to decide what
// kind of interaction it is.
- private static final long CANCEL_ON_PAUSE_THRESHOLD_NOT_STARTED_MS = 150;
+ private static final long CANCEL_ON_PAUSE_THRESHOLD_NOT_STARTED_MS = 200;
// Time threshold used to determine if a gesture should be cancelled. If
// the finger pauses for longer than this delay, the ongoing gesture is
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index f231f92..3b0b79a 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -718,7 +718,8 @@
public void onUserAdded(int userHandle) {
// If the user is restricted tie them to the parent user's VPN
UserInfo user = UserManager.get(mContext).getUserInfo(userHandle);
- if (user.isRestricted() && user.restrictedProfileParentId == mUserHandle) {
+ if (user.isRestricted() && user.restrictedProfileParentId == mUserHandle
+ && mVpnUsers != null) {
synchronized(Vpn.this) {
try {
addVpnUserLocked(userHandle);
@@ -736,7 +737,8 @@
public void onUserRemoved(int userHandle) {
// clean up if restricted
UserInfo user = UserManager.get(mContext).getUserInfo(userHandle);
- if (user.isRestricted() && user.restrictedProfileParentId == mUserHandle) {
+ if (user.isRestricted() && user.restrictedProfileParentId == mUserHandle
+ && mVpnUsers != null) {
synchronized(Vpn.this) {
try {
removeVpnUserLocked(userHandle);
diff --git a/services/core/java/com/android/server/notification/ManagedServices.java b/services/core/java/com/android/server/notification/ManagedServices.java
index 17313b6..6cf3940 100644
--- a/services/core/java/com/android/server/notification/ManagedServices.java
+++ b/services/core/java/com/android/server/notification/ManagedServices.java
@@ -328,12 +328,16 @@
component.flattenToShortString());
}
- final int[] userIds = mUserProfiles.getCurrentProfileIds();
- for (int userId : userIds) {
- if (enabled) {
- registerServiceLocked(component, userId);
- } else {
- unregisterServiceLocked(component, userId);
+
+ synchronized (mMutex) {
+ final int[] userIds = mUserProfiles.getCurrentProfileIds();
+
+ for (int userId : userIds) {
+ if (enabled) {
+ registerServiceLocked(component, userId);
+ } else {
+ unregisterServiceLocked(component, userId);
+ }
}
}
}
@@ -453,7 +457,7 @@
return queryPackageForServices(packageName, userId, null);
}
- protected Set<ComponentName> queryPackageForServices(String packageName, int userId,
+ public Set<ComponentName> queryPackageForServices(String packageName, int userId,
String category) {
Set<ComponentName> installed = new ArraySet<>();
final PackageManager pm = mContext.getPackageManager();
@@ -636,7 +640,21 @@
}
}
+ /**
+ * Inject a system service into the management list.
+ */
+ public void registerSystemService(final ComponentName name, final int userid) {
+ synchronized (mMutex) {
+ registerServiceLocked(name, userid, true /* isSystem */);
+ }
+ }
+
private void registerServiceLocked(final ComponentName name, final int userid) {
+ registerServiceLocked(name, userid, false /* isSystem */);
+ }
+
+ private void registerServiceLocked(final ComponentName name, final int userid,
+ final boolean isSystem) {
if (DEBUG) Slog.v(TAG, "registerService: " + name + " u=" + userid);
final String servicesBindingTag = name.toString() + "/" + userid;
@@ -694,7 +712,7 @@
try {
mService = asInterface(binder);
info = newServiceInfo(mService, name,
- userid, false /*isSystem*/, this, targetSdkVersion);
+ userid, isSystem, this, targetSdkVersion);
binder.linkToDeath(info, 0);
added = mServices.add(info);
} catch (RemoteException e) {
@@ -890,6 +908,7 @@
return false;
}
if (this.userid == UserHandle.USER_ALL) return true;
+ if (this.userid == UserHandle.USER_SYSTEM) return true;
if (nid == UserHandle.USER_ALL || nid == this.userid) return true;
return supportsProfiles() && mUserProfiles.isCurrentProfile(nid);
}
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 24ffe1f..02c786e 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -160,6 +160,7 @@
import java.util.List;
import java.util.Map.Entry;
import java.util.Objects;
+import java.util.Set;
import java.util.concurrent.TimeUnit;
/** {@hide} */
@@ -212,6 +213,7 @@
/** notification_enqueue status value for an ignored notification. */
private static final int EVENTLOG_ENQUEUE_STATUS_IGNORED = 2;
+ private String mRankerServicePackageName;
private IActivityManager mAm;
AudioManager mAudioManager;
@@ -289,7 +291,7 @@
private final UserProfiles mUserProfiles = new UserProfiles();
private NotificationListeners mListeners;
- private NotificationRanker mRankerServices;
+ private NotificationRankers mRankerServices;
private ConditionProviders mConditionProviders;
private NotificationUsageStats mUsageStats;
@@ -887,6 +889,10 @@
mVibrator = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE);
mAppUsageStats = LocalServices.getService(UsageStatsManagerInternal.class);
+ // This is the package that contains the AOSP framework update.
+ mRankerServicePackageName = getContext().getPackageManager()
+ .getServicesSystemSharedLibraryPackageName();
+
mHandler = new WorkerHandler();
mRankingThread.start();
String[] extractorNames;
@@ -931,8 +937,26 @@
importOldBlockDb();
+ // This is a MangedServices object that keeps track of the listeners.
mListeners = new NotificationListeners();
- mRankerServices = new NotificationRanker();
+
+ // This is a MangedServices object that keeps track of the ranker.
+ mRankerServices = new NotificationRankers();
+ // Find the updatable ranker and register it.
+ Set<ComponentName> rankerComponents = mRankerServices.queryPackageForServices(
+ mRankerServicePackageName, UserHandle.USER_SYSTEM, null);
+ Iterator<ComponentName> iterator = rankerComponents.iterator();
+ if (iterator.hasNext()) {
+ ComponentName rankerComponent = iterator.next();
+ if (iterator.hasNext()) {
+ Slog.e(TAG, "found multiple ranker services:" + rankerComponents);
+ } else {
+ mRankerServices.registerSystemService(rankerComponent, UserHandle.USER_SYSTEM);
+ }
+ } else {
+ Slog.w(TAG, "could not start ranker service: none found");
+ }
+
mStatusBar = getLocalService(StatusBarManagerInternal.class);
mStatusBar.setNotificationDelegate(mNotificationDelegate);
@@ -1410,13 +1434,9 @@
*/
@Override
public void registerListener(final INotificationListener listener,
- final ComponentName component, final int userid, boolean asRanker) {
+ final ComponentName component, final int userid) {
enforceSystemOrSystemUI("INotificationManager.registerListener");
- if (asRanker) {
- mRankerServices.registerService(listener, component, userid);
- } else {
- mListeners.registerService(listener, component, userid);
- }
+ mListeners.registerService(listener, component, userid);
}
/**
@@ -2138,6 +2158,7 @@
pw.print(listener.component);
}
pw.println(')');
+ pw.println("\n mRankerServicePackageName: " + mRankerServicePackageName);
pw.println("\n Notification ranker services:");
mRankerServices.dump(pw, filter);
}
@@ -3485,9 +3506,9 @@
}
}
- public class NotificationRanker extends ManagedServices {
+ public class NotificationRankers extends ManagedServices {
- public NotificationRanker() {
+ public NotificationRankers() {
super(getContext(), mHandler, mNotificationList, mUserProfiles);
}
@@ -3530,7 +3551,7 @@
// mServices is the list inside ManagedServices of all the rankers,
// There should be only one, but it's a list, so while we enforce
// singularity elsewhere, we keep it general here, to avoid surprises.
- for (final ManagedServiceInfo info : NotificationRanker.this.mServices) {
+ for (final ManagedServiceInfo info : NotificationRankers.this.mServices) {
boolean sbnVisible = isVisibleToListener(sbn, info);
if (!sbnVisible) {
continue;
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index cd1c5e9..ea437d0 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -251,6 +251,30 @@
*/
public static final String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool";
+ /**
+ * Default WFC_IMS_mode 0: WIFI_ONLY
+ * 1: CELLULAR_PREFERRED
+ * 2: WIFI_PREFERRED
+ * @hide
+ */
+ public static final String KEY_CARRIER_DEFAULT_WFC_IMS_MODE_INT =
+ "carrier_default_wfc_ims_mode_int";
+ /**
+ * Default WFC_IMS_enabled: true VoWiFi by default is on
+ * false VoWiFi by default is off
+ * @hide
+ */
+ public static final String KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL =
+ "carrier_default_wfc_ims_enabled_bool";
+
+ /**
+ * Default WFC_IMS_roaming_enabled: true VoWiFi roaming by default is on
+ * false VoWiFi roaming by default is off
+ * @hide
+ */
+ public static final String KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_ENABLED_BOOL =
+ "carrier_default_wfc_ims_roaming_enabled_bool";
+
/** Flag specifying whether provisioning is required for VOLTE. */
public static final String KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL
= "carrier_volte_provisioning_required_bool";
@@ -613,6 +637,9 @@
sDefaults.putBoolean(KEY_CARRIER_VOLTE_AVAILABLE_BOOL, false);
sDefaults.putBoolean(KEY_CARRIER_VT_AVAILABLE_BOOL, false);
sDefaults.putBoolean(KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL, false);
+ sDefaults.putBoolean(KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL, false);
+ sDefaults.putBoolean(KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_ENABLED_BOOL, false);
+ sDefaults.putInt(KEY_CARRIER_DEFAULT_WFC_IMS_MODE_INT, 2);
sDefaults.putBoolean(KEY_CARRIER_FORCE_DISABLE_ETWS_CMAS_TEST_BOOL, false);
sDefaults.putBoolean(KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL, false);
sDefaults.putBoolean(KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL, true);