Merge "Fix issue for Preference.setSingleLineTitle() has no effect." into oc-support-26.0-dev
diff --git a/annotations/src/android/support/annotation/MainThread.java b/annotations/src/android/support/annotation/MainThread.java
index 5478751..2f50306 100644
--- a/annotations/src/android/support/annotation/MainThread.java
+++ b/annotations/src/android/support/annotation/MainThread.java
@@ -34,9 +34,17 @@
* @MainThread
* public void deliverResult(D data) { ... }
* </code></pre>
+ *
+ * <p class="note"><b>Note:</b> Ordinarily, an app's main thread is also the UI
+ * thread. However, However, under special circumstances, an app's main thread
+ * might not be its UI thread; for more information, see
+ * <a href="/studio/write/annotations.html#thread-annotations">Thread
+ * annotations</a>.
+ *
+ * @see android.support.annotation.UiThread
*/
@Documented
@Retention(CLASS)
@Target({METHOD,CONSTRUCTOR,TYPE})
public @interface MainThread {
-}
\ No newline at end of file
+}
diff --git a/annotations/src/android/support/annotation/UiThread.java b/annotations/src/android/support/annotation/UiThread.java
index ef81986..0a9a0c1 100644
--- a/annotations/src/android/support/annotation/UiThread.java
+++ b/annotations/src/android/support/annotation/UiThread.java
@@ -35,9 +35,17 @@
*
* public abstract void setText(@NonNull String text) { ... }
* </code></pre>
+ *
+ * <p class="note"><b>Note:</b> Ordinarily, an app's UI thread is also the main
+ * thread. However, However, under special circumstances, an app's UI thread
+ * might not be its main thread; for more information, see
+ * <a href="/studio/write/annotations.html#thread-annotations">Thread
+ * annotations</a>.
+ *
+ * @see android.support.annotation.MainThread
*/
@Documented
@Retention(CLASS)
@Target({METHOD,CONSTRUCTOR,TYPE})
public @interface UiThread {
-}
\ No newline at end of file
+}
diff --git a/api/26.0.0-SNAPSHOT.txt b/api/26.0.0-SNAPSHOT.txt
index 2cd0c13..aafd5f9 100644
--- a/api/26.0.0-SNAPSHOT.txt
+++ b/api/26.0.0-SNAPSHOT.txt
@@ -6235,7 +6235,6 @@
method public static int getActionCount(android.app.Notification);
method public static int getBadgeIconType(android.app.Notification);
method public static java.lang.String getCategory(android.app.Notification);
- method public static deprecated java.lang.String getChannel(android.app.Notification);
method public static java.lang.String getChannelId(android.app.Notification);
method public static android.os.Bundle getExtras(android.app.Notification);
method public static java.lang.String getGroup(android.app.Notification);
@@ -6243,7 +6242,6 @@
method public static boolean getLocalOnly(android.app.Notification);
method public static java.lang.String getShortcutId(android.app.Notification);
method public static java.lang.String getSortKey(android.app.Notification);
- method public static deprecated long getTimeout(android.app.Notification);
method public static long getTimeoutAfter(android.app.Notification);
method public static boolean isGroupSummary(android.app.Notification);
field public static final int BADGE_ICON_LARGE = 2; // 0x2
@@ -6400,7 +6398,6 @@
method public android.support.v4.app.NotificationCompat.Builder setAutoCancel(boolean);
method public android.support.v4.app.NotificationCompat.Builder setBadgeIconType(int);
method public android.support.v4.app.NotificationCompat.Builder setCategory(java.lang.String);
- method public deprecated android.support.v4.app.NotificationCompat.Builder setChannel(java.lang.String);
method public android.support.v4.app.NotificationCompat.Builder setChannelId(java.lang.String);
method public android.support.v4.app.NotificationCompat.Builder setColor(int);
method public android.support.v4.app.NotificationCompat.Builder setColorized(boolean);
@@ -6440,7 +6437,6 @@
method public android.support.v4.app.NotificationCompat.Builder setSubText(java.lang.CharSequence);
method public android.support.v4.app.NotificationCompat.Builder setTicker(java.lang.CharSequence);
method public android.support.v4.app.NotificationCompat.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
- method public deprecated android.support.v4.app.NotificationCompat.Builder setTimeout(long);
method public android.support.v4.app.NotificationCompat.Builder setTimeoutAfter(long);
method public android.support.v4.app.NotificationCompat.Builder setUsesChronometer(boolean);
method public android.support.v4.app.NotificationCompat.Builder setVibrate(long[]);
@@ -12658,7 +12654,8 @@
method public void attachToRecyclerView(android.support.v7.widget.RecyclerView) throws java.lang.IllegalStateException;
method public abstract int[] calculateDistanceToFinalSnap(android.support.v7.widget.RecyclerView.LayoutManager, android.view.View);
method public int[] calculateScrollDistance(int, int);
- method protected android.support.v7.widget.LinearSmoothScroller createSnapScroller(android.support.v7.widget.RecyclerView.LayoutManager);
+ method protected android.support.v7.widget.RecyclerView.SmoothScroller createScroller(android.support.v7.widget.RecyclerView.LayoutManager);
+ method protected deprecated android.support.v7.widget.LinearSmoothScroller createSnapScroller(android.support.v7.widget.RecyclerView.LayoutManager);
method public abstract android.view.View findSnapView(android.support.v7.widget.RecyclerView.LayoutManager);
method public abstract int findTargetSnapPosition(android.support.v7.widget.RecyclerView.LayoutManager, int, int);
method public boolean onFling(int, int);
diff --git a/buildSrc/dependencies.gradle b/buildSrc/dependencies.gradle
index 5cf3ae6..a58b1d0 100644
--- a/buildSrc/dependencies.gradle
+++ b/buildSrc/dependencies.gradle
@@ -25,6 +25,7 @@
libs.espresso_core = 'com.android.support.test.espresso:espresso-core:2.3-alpha'
libs.espresso_contrib = 'com.android.support.test.espresso:espresso-contrib:2.3-alpha'
libs.jacoco = 'org.jacoco:org.jacoco.core:0.7.8'
+libs.test_rules = 'com.android.support.test:rules:0.6-alpha'
def androidPluginVersionOverride = System.getenv("GRADLE_PLUGIN_VERSION")
@@ -32,7 +33,7 @@
libs.gradle = 'com.android.tools.build:gradle:' + androidPluginVersionOverride
} else {
// Keep gradle plugin version in sync with ub_supportlib-master manifest.
- libs.gradle = 'com.android.tools.build:gradle:2.4.0-alpha6'
+ libs.gradle = 'com.android.tools.build:gradle:3.0.0-alpha4'
}
// Other dependencies
diff --git a/buildSrc/diff_and_docs.gradle b/buildSrc/diff_and_docs.gradle
index 47fcefc..8cfc91b 100644
--- a/buildSrc/diff_and_docs.gradle
+++ b/buildSrc/diff_and_docs.gradle
@@ -440,7 +440,7 @@
fileTree(releaseVariant.aidlCompile.sourceOutputDir) +
fileTree(releaseVariant.outputs[0].processResources.sourceOutputDir)
}
- task.classpath += files{releaseVariant.javaCompile.classpath.files} +
+ task.classpath += releaseVariant.getCompileClasspath(null) +
files(releaseVariant.javaCompile.destinationDir)
}
diff --git a/buildSrc/init.gradle b/buildSrc/init.gradle
index 3bd6d16..2cde002 100644
--- a/buildSrc/init.gradle
+++ b/buildSrc/init.gradle
@@ -202,17 +202,14 @@
archiveName "${project.archivesBaseName}-${v.baseName}-allclasses.jar"
}
- def jacocoAntConfig =
- project.configurations[JacocoPlugin.ANT_CONFIGURATION_NAME]
- def jacocoAntArtifacts = jacocoAntConfig.resolvedConfiguration
- .resolvedArtifacts
-
def collectJacocoAntPackages = project.tasks.create(
name: "collectJacocoAntPackages",
type: Jar) {
inputs.files project.configurations[JacocoPlugin.ANT_CONFIGURATION_NAME]
from {
- jacocoAntArtifacts.collect{ zipTree(it.getFile()) }} {
+ project.configurations[JacocoPlugin.ANT_CONFIGURATION_NAME]
+ .resolvedConfiguration
+ .resolvedArtifacts.collect{ zipTree(it.getFile()) }} {
// exclude all the signatures the jar might have
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
@@ -284,9 +281,10 @@
task.doLast {
def source = testApk ? project.android.sourceSets.androidTest
: project.android.sourceSets.main
- if (task.hasProperty("outputFile") && !source.java.sourceFiles.isEmpty()) {
+ if (task.hasProperty("outputDirectory") && !source.java.sourceFiles.isEmpty()) {
copy {
- from(task.outputFile)
+ from(task.outputDirectory)
+ include '*.apk'
into(rootProject.ext.testApkDistOut)
rename { String fileName ->
// multiple modules may have the same name so prefix the name with
diff --git a/compat/api24/android/support/v4/app/NotificationCompatApi24.java b/compat/api24/android/support/v4/app/NotificationCompatApi24.java
index 17e5cad..67ea5dc 100644
--- a/compat/api24/android/support/v4/app/NotificationCompatApi24.java
+++ b/compat/api24/android/support/v4/app/NotificationCompatApi24.java
@@ -30,6 +30,7 @@
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
+import android.os.Parcelable;
import android.support.annotation.RequiresApi;
import android.widget.RemoteViews;
@@ -181,8 +182,89 @@
}
actionExtras.putBoolean(NotificationCompatJellybean.EXTRA_ALLOW_GENERATED_REPLIES,
action.getAllowGeneratedReplies());
- actionBuilder.addExtras(actionExtras);
actionBuilder.setAllowGeneratedReplies(action.getAllowGeneratedReplies());
+ actionBuilder.addExtras(actionExtras);
b.addAction(actionBuilder.build());
}
+
+ public static NotificationCompatBase.Action getAction(Notification notif,
+ int actionIndex, NotificationCompatBase.Action.Factory actionFactory,
+ RemoteInputCompatBase.RemoteInput.Factory remoteInputFactory) {
+ return getActionCompatFromAction(notif.actions[actionIndex], actionFactory,
+ remoteInputFactory);
+ }
+
+ private static NotificationCompatBase.Action getActionCompatFromAction(
+ Notification.Action action, NotificationCompatBase.Action.Factory actionFactory,
+ RemoteInputCompatBase.RemoteInput.Factory remoteInputFactory) {
+ RemoteInputCompatBase.RemoteInput[] remoteInputs = RemoteInputCompatApi20.toCompat(
+ action.getRemoteInputs(), remoteInputFactory);
+ boolean allowGeneratedReplies = action.getExtras().getBoolean(
+ NotificationCompatJellybean.EXTRA_ALLOW_GENERATED_REPLIES)
+ || action.getAllowGeneratedReplies();
+ return actionFactory.build(action.icon, action.title, action.actionIntent,
+ action.getExtras(), remoteInputs, null, allowGeneratedReplies);
+ }
+
+ private static Notification.Action getActionFromActionCompat(
+ NotificationCompatBase.Action actionCompat) {
+ Notification.Action.Builder actionBuilder = new Notification.Action.Builder(
+ actionCompat.getIcon(), actionCompat.getTitle(), actionCompat.getActionIntent());
+ Bundle actionExtras;
+ if (actionCompat.getExtras() != null) {
+ actionExtras = new Bundle(actionCompat.getExtras());
+ } else {
+ actionExtras = new Bundle();
+ }
+ actionExtras.putBoolean(NotificationCompatJellybean.EXTRA_ALLOW_GENERATED_REPLIES,
+ actionCompat.getAllowGeneratedReplies());
+ actionBuilder.setAllowGeneratedReplies(actionCompat.getAllowGeneratedReplies());
+ actionBuilder.addExtras(actionExtras);
+ RemoteInputCompatBase.RemoteInput[] remoteInputCompats = actionCompat.getRemoteInputs();
+ if (remoteInputCompats != null) {
+ RemoteInput[] remoteInputs = RemoteInputCompatApi20.fromCompat(remoteInputCompats);
+ for (RemoteInput remoteInput : remoteInputs) {
+ actionBuilder.addRemoteInput(remoteInput);
+ }
+ }
+ return actionBuilder.build();
+ }
+
+ /**
+ * Get a list of notification compat actions by parsing actions stored within a list of
+ * parcelables using the {@link Bundle#getParcelableArrayList} function in the same
+ * manner that framework code would do so. In API20, Using Action parcelable directly
+ * is correct.
+ */
+ public static NotificationCompatBase.Action[] getActionsFromParcelableArrayList(
+ ArrayList<Parcelable> parcelables,
+ NotificationCompatBase.Action.Factory actionFactory,
+ RemoteInputCompatBase.RemoteInput.Factory remoteInputFactory) {
+ if (parcelables == null) {
+ return null;
+ }
+ NotificationCompatBase.Action[] actions = actionFactory.newArray(parcelables.size());
+ for (int i = 0; i < actions.length; i++) {
+ Notification.Action action = (Notification.Action) parcelables.get(i);
+ actions[i] = getActionCompatFromAction(action, actionFactory, remoteInputFactory);
+ }
+ return actions;
+ }
+
+ /**
+ * Get an array list of parcelables, suitable for {@link Bundle#putParcelableArrayList},
+ * that matches what framework code would do to store an actions list in this way. In API20,
+ * action parcelables were directly placed as entries in the array list.
+ */
+ public static ArrayList<Parcelable> getParcelableArrayListForActions(
+ NotificationCompatBase.Action[] actions) {
+ if (actions == null) {
+ return null;
+ }
+ ArrayList<Parcelable> parcelables = new ArrayList<Parcelable>(actions.length);
+ for (NotificationCompatBase.Action action : actions) {
+ parcelables.add(getActionFromActionCompat(action));
+ }
+ return parcelables;
+ }
}
diff --git a/compat/ics/android/support/v4/graphics/PaintCompatApi14.java b/compat/ics/android/support/v4/graphics/PaintCompatApi14.java
index 86e87d8..7a7de7c 100644
--- a/compat/ics/android/support/v4/graphics/PaintCompatApi14.java
+++ b/compat/ics/android/support/v4/graphics/PaintCompatApi14.java
@@ -24,6 +24,7 @@
class PaintCompatApi14 {
// U+DFFFD which is very end of unassigned plane.
private static final String TOFU_STRING = "\uDB3F\uDFFD";
+ private static final String EM_STRING = "m";
private static final ThreadLocal<Pair<Rect, Rect>> sRectThreadLocal = new ThreadLocal<>();
@@ -36,6 +37,8 @@
}
final float missingGlyphWidth = paint.measureText(TOFU_STRING);
+ final float emGlyphWidth = paint.measureText(EM_STRING);
+
final float width = paint.measureText(string);
if (width == 0f) {
@@ -46,7 +49,7 @@
if (string.codePointCount(0, string.length()) > 1) {
// Heuristic to detect fallback glyphs for ligatures like flags and ZWJ sequences
// Return false if string is rendered too widely
- if (width > 2 * missingGlyphWidth) {
+ if (width > 2 * emGlyphWidth) {
return false;
}
diff --git a/compat/java/android/support/v4/app/NotificationCompat.java b/compat/java/android/support/v4/app/NotificationCompat.java
index 9129cc7..10da04a 100644
--- a/compat/java/android/support/v4/app/NotificationCompat.java
+++ b/compat/java/android/support/v4/app/NotificationCompat.java
@@ -24,6 +24,7 @@
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
+import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.media.AudioManager;
@@ -34,9 +35,15 @@
import android.support.annotation.ColorInt;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
+import android.support.v4.text.BidiFormatter;
import android.support.v4.view.GravityCompat;
+import android.text.SpannableStringBuilder;
+import android.text.Spanned;
+import android.text.TextUtils;
+import android.text.style.TextAppearanceSpan;
import android.view.Gravity;
import android.widget.RemoteViews;
@@ -597,10 +604,27 @@
@RestrictTo(LIBRARY_GROUP)
protected static class BuilderExtender {
public Notification build(Builder b, NotificationBuilderWithBuilderAccessor builder) {
+ RemoteViews styleContentView = b.mStyle != null
+ ? b.mStyle.makeContentView(builder)
+ : null;
Notification n = builder.build();
- if (b.mContentView != null) {
+ if (styleContentView != null) {
+ n.contentView = styleContentView;
+ } else if (b.mContentView != null) {
n.contentView = b.mContentView;
}
+ if (Build.VERSION.SDK_INT >= 16 && b.mStyle != null) {
+ RemoteViews styleBigContentView = b.mStyle.makeBigContentView(builder);
+ if (styleBigContentView != null) {
+ n.bigContentView = styleBigContentView;
+ }
+ }
+ if (Build.VERSION.SDK_INT >= 21 && b.mStyle != null) {
+ RemoteViews styleHeadsUpContentView = b.mStyle.makeHeadsUpContentView(builder);
+ if (styleHeadsUpContentView != null) {
+ n.headsUpContentView = styleHeadsUpContentView;
+ }
+ }
return n;
}
}
@@ -655,7 +679,7 @@
public Notification build(Builder b, BuilderExtender extender) {
BuilderBase builder =
new BuilderBase(b.mContext, b.mNotification,
- b.resolveTitle(), b.resolveText(), b.mContentInfo, b.mTickerView,
+ b.mContentTitle, b.mContentText, b.mContentInfo, b.mTickerView,
b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon,
b.mProgressMax, b.mProgress, b.mProgressIndeterminate);
return extender.build(b, builder);
@@ -694,13 +718,15 @@
@Override
public Notification build(Builder b, BuilderExtender extender) {
NotificationCompatJellybean.Builder builder = new NotificationCompatJellybean.Builder(
- b.mContext, b.mNotification, b.resolveTitle(), b.resolveText(), b.mContentInfo,
+ b.mContext, b.mNotification, b.mContentTitle, b.mContentText, b.mContentInfo,
b.mTickerView, b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon,
b.mProgressMax, b.mProgress, b.mProgressIndeterminate,
b.mUseChronometer, b.mPriority, b.mSubText, b.mLocalOnly, b.mExtras,
b.mGroupKey, b.mGroupSummary, b.mSortKey, b.mContentView, b.mBigContentView);
addActionsToBuilder(builder, b.mActions);
- addStyleToBuilderJellybean(builder, b.mStyle);
+ if (b.mStyle != null) {
+ b.mStyle.apply(builder);
+ }
Notification notification = extender.build(b, builder);
if (b.mStyle != null) {
Bundle extras = getExtras(notification);
@@ -736,14 +762,16 @@
@Override
public Notification build(Builder b, BuilderExtender extender) {
NotificationCompatKitKat.Builder builder = new NotificationCompatKitKat.Builder(
- b.mContext, b.mNotification, b.resolveTitle(), b.resolveText(), b.mContentInfo,
+ b.mContext, b.mNotification, b.mContentTitle, b.mContentText, b.mContentInfo,
b.mTickerView, b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon,
b.mProgressMax, b.mProgress, b.mProgressIndeterminate, b.mShowWhen,
b.mUseChronometer, b.mPriority, b.mSubText, b.mLocalOnly,
b.mPeople, b.mExtras, b.mGroupKey, b.mGroupSummary, b.mSortKey,
b.mContentView, b.mBigContentView);
addActionsToBuilder(builder, b.mActions);
- addStyleToBuilderJellybean(builder, b.mStyle);
+ if (b.mStyle != null) {
+ b.mStyle.apply(builder);
+ }
return extender.build(b, builder);
}
@@ -759,14 +787,16 @@
@Override
public Notification build(Builder b, BuilderExtender extender) {
NotificationCompatApi20.Builder builder = new NotificationCompatApi20.Builder(
- b.mContext, b.mNotification, b.resolveTitle(), b.resolveText(), b.mContentInfo,
+ b.mContext, b.mNotification, b.mContentTitle, b.mContentText, b.mContentInfo,
b.mTickerView, b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon,
b.mProgressMax, b.mProgress, b.mProgressIndeterminate, b.mShowWhen,
b.mUseChronometer, b.mPriority, b.mSubText, b.mLocalOnly, b.mPeople, b.mExtras,
b.mGroupKey, b.mGroupSummary, b.mSortKey, b.mContentView, b.mBigContentView,
b.mGroupAlertBehavior);
addActionsToBuilder(builder, b.mActions);
- addStyleToBuilderJellybean(builder, b.mStyle);
+ if (b.mStyle != null) {
+ b.mStyle.apply(builder);
+ }
Notification notification = extender.build(b, builder);
if (b.mStyle != null) {
b.mStyle.addCompatExtras(getExtras(notification));
@@ -799,7 +829,7 @@
@Override
public Notification build(Builder b, BuilderExtender extender) {
NotificationCompatApi21.Builder builder = new NotificationCompatApi21.Builder(
- b.mContext, b.mNotification, b.resolveTitle(), b.resolveText(), b.mContentInfo,
+ b.mContext, b.mNotification, b.mContentTitle, b.mContentText, b.mContentInfo,
b.mTickerView, b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon,
b.mProgressMax, b.mProgress, b.mProgressIndeterminate, b.mShowWhen,
b.mUseChronometer, b.mPriority, b.mSubText, b.mLocalOnly, b.mCategory,
@@ -807,7 +837,9 @@
b.mGroupKey, b.mGroupSummary, b.mSortKey, b.mContentView, b.mBigContentView,
b.mHeadsUpContentView, b.mGroupAlertBehavior);
addActionsToBuilder(builder, b.mActions);
- addStyleToBuilderJellybean(builder, b.mStyle);
+ if (b.mStyle != null) {
+ b.mStyle.apply(builder);
+ }
Notification notification = extender.build(b, builder);
if (b.mStyle != null) {
b.mStyle.addCompatExtras(getExtras(notification));
@@ -843,13 +875,34 @@
b.mGroupKey, b.mGroupSummary, b.mSortKey, b.mRemoteInputHistory, b.mContentView,
b.mBigContentView, b.mHeadsUpContentView, b.mGroupAlertBehavior);
addActionsToBuilder(builder, b.mActions);
- addStyleToBuilderApi24(builder, b.mStyle);
+ if (b.mStyle != null) {
+ b.mStyle.apply(builder);
+ }
Notification notification = extender.build(b, builder);
if (b.mStyle != null) {
b.mStyle.addCompatExtras(getExtras(notification));
}
return notification;
}
+
+ @Override
+ public Action getAction(Notification n, int actionIndex) {
+ return (Action) NotificationCompatApi24.getAction(n, actionIndex, Action.FACTORY,
+ RemoteInput.FACTORY);
+ }
+
+ @Override
+ public Action[] getActionsFromParcelableArrayList(
+ ArrayList<Parcelable> parcelables) {
+ return (Action[]) NotificationCompatApi24.getActionsFromParcelableArrayList(
+ parcelables, Action.FACTORY, RemoteInput.FACTORY);
+ }
+
+ @Override
+ public ArrayList<Parcelable> getParcelableArrayListForActions(
+ Action[] actions) {
+ return NotificationCompatApi24.getParcelableArrayListForActions(actions);
+ }
}
@RequiresApi(26)
@@ -868,7 +921,9 @@
b.mShortcutId, b.mTimeout, b.mColorized, b.mColorizedSet,
b.mGroupAlertBehavior);
addActionsToBuilder(builder, b.mActions);
- addStyleToBuilderApi24(builder, b.mStyle);
+ if (b.mStyle != null) {
+ b.mStyle.apply(builder);
+ }
Notification notification = extender.build(b, builder);
if (b.mStyle != null) {
b.mStyle.addCompatExtras(getExtras(notification));
@@ -884,65 +939,6 @@
}
}
- @RequiresApi(16)
- static void addStyleToBuilderJellybean(NotificationBuilderWithBuilderAccessor builder,
- Style style) {
- if (style != null) {
- if (style instanceof BigTextStyle) {
- BigTextStyle bigTextStyle = (BigTextStyle) style;
- NotificationCompatJellybean.addBigTextStyle(builder,
- bigTextStyle.mBigContentTitle,
- bigTextStyle.mSummaryTextSet,
- bigTextStyle.mSummaryText,
- bigTextStyle.mBigText);
- } else if (style instanceof InboxStyle) {
- InboxStyle inboxStyle = (InboxStyle) style;
- NotificationCompatJellybean.addInboxStyle(builder,
- inboxStyle.mBigContentTitle,
- inboxStyle.mSummaryTextSet,
- inboxStyle.mSummaryText,
- inboxStyle.mTexts);
- } else if (style instanceof BigPictureStyle) {
- BigPictureStyle bigPictureStyle = (BigPictureStyle) style;
- NotificationCompatJellybean.addBigPictureStyle(builder,
- bigPictureStyle.mBigContentTitle,
- bigPictureStyle.mSummaryTextSet,
- bigPictureStyle.mSummaryText,
- bigPictureStyle.mPicture,
- bigPictureStyle.mBigLargeIcon,
- bigPictureStyle.mBigLargeIconSet);
- }
- }
- }
-
- @RequiresApi(24)
- static void addStyleToBuilderApi24(NotificationBuilderWithBuilderAccessor builder,
- Style style) {
- if (style != null) {
- if (style instanceof MessagingStyle) {
- MessagingStyle messagingStyle = (MessagingStyle) style;
- List<CharSequence> texts = new ArrayList<>();
- List<Long> timestamps = new ArrayList<>();
- List<CharSequence> senders = new ArrayList<>();
- List<String> dataMimeTypes = new ArrayList<>();
- List<Uri> dataUris = new ArrayList<>();
-
- for (MessagingStyle.Message message : messagingStyle.mMessages) {
- texts.add(message.getText());
- timestamps.add(message.getTimestamp());
- senders.add(message.getSender());
- dataMimeTypes.add(message.getDataMimeType());
- dataUris.add(message.getDataUri());
- }
- NotificationCompatApi24.addMessagingStyle(builder, messagingStyle.mUserDisplayName,
- messagingStyle.mConversationTitle, texts, timestamps, senders,
- dataMimeTypes, dataUris);
- } else {
- addStyleToBuilderJellybean(builder, style);
- }
- }
- }
-
static {
if (Build.VERSION.SDK_INT >= 26) {
IMPL = new NotificationCompatApi26Impl();
@@ -1778,12 +1774,6 @@
return this;
}
- /** @deprecated removed from API 26 */
- @Deprecated
- public Builder setChannel(@NonNull String channelId) {
- return setChannelId(channelId);
- }
-
/**
* Specifies the time at which this notification should be canceled, if it is not already
* canceled.
@@ -1793,12 +1783,6 @@
return this;
}
- /** @deprecated removed from API 26 */
- @Deprecated
- public Builder setTimeout(long durationMs) {
- return setTimeoutAfter(durationMs);
- }
-
/**
* If this notification is duplicative of a Launcher shortcut, sets the
* {@link android.support.v4.content.pm.ShortcutInfoCompat#getId() id} of the shortcut, in
@@ -1936,27 +1920,6 @@
public int getColor() {
return mColor;
}
-
-
- /**
- * @return the text of the notification
- *
- * @hide
- */
- @RestrictTo(LIBRARY_GROUP)
- protected CharSequence resolveText() {
- return mContentText;
- }
-
- /**
- * @return the title of the notification
- *
- * @hide
- */
- @RestrictTo(LIBRARY_GROUP)
- protected CharSequence resolveTitle() {
- return mContentTitle;
- }
}
/**
@@ -1967,7 +1930,11 @@
* effect.
*/
public static abstract class Style {
- Builder mBuilder;
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ protected Builder mBuilder;
CharSequence mBigContentTitle;
CharSequence mSummaryText;
boolean mSummaryTextSet = false;
@@ -1994,6 +1961,38 @@
*/
@RestrictTo(LIBRARY_GROUP)
// TODO: implement for all styles
+ public void apply(NotificationBuilderWithBuilderAccessor builder) {
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ public RemoteViews makeContentView(NotificationBuilderWithBuilderAccessor builder) {
+ return null;
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ public RemoteViews makeBigContentView(NotificationBuilderWithBuilderAccessor builder) {
+ return null;
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ public RemoteViews makeHeadsUpContentView(NotificationBuilderWithBuilderAccessor builder) {
+ return null;
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ // TODO: implement for all styles
public void addCompatExtras(Bundle extras) {
}
@@ -2027,9 +2026,9 @@
* @see Notification#bigContentView
*/
public static class BigPictureStyle extends Style {
- Bitmap mPicture;
- Bitmap mBigLargeIcon;
- boolean mBigLargeIconSet;
+ private Bitmap mPicture;
+ private Bitmap mBigLargeIcon;
+ private boolean mBigLargeIconSet;
public BigPictureStyle() {
}
@@ -2072,6 +2071,23 @@
mBigLargeIconSet = true;
return this;
}
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public void apply(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 16) {
+ NotificationCompatJellybean.addBigPictureStyle(builder,
+ mBigContentTitle,
+ mSummaryTextSet,
+ mSummaryText,
+ mPicture,
+ mBigLargeIcon,
+ mBigLargeIconSet);
+ }
+ }
}
/**
@@ -2096,7 +2112,7 @@
* @see Notification#bigContentView
*/
public static class BigTextStyle extends Style {
- CharSequence mBigText;
+ private CharSequence mBigText;
public BigTextStyle() {
}
@@ -2131,6 +2147,21 @@
mBigText = Builder.limitCharSequenceLength(cs);
return this;
}
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public void apply(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 16) {
+ NotificationCompatJellybean.addBigTextStyle(builder,
+ mBigContentTitle,
+ mSummaryTextSet,
+ mSummaryText,
+ mBigText);
+ }
+ }
}
/**
@@ -2283,6 +2314,121 @@
return style;
}
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public void apply(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 24) {
+ List<CharSequence> texts = new ArrayList<>();
+ List<Long> timestamps = new ArrayList<>();
+ List<CharSequence> senders = new ArrayList<>();
+ List<String> dataMimeTypes = new ArrayList<>();
+ List<Uri> dataUris = new ArrayList<>();
+
+ for (MessagingStyle.Message message : mMessages) {
+ texts.add(message.getText());
+ timestamps.add(message.getTimestamp());
+ senders.add(message.getSender());
+ dataMimeTypes.add(message.getDataMimeType());
+ dataUris.add(message.getDataUri());
+ }
+ NotificationCompatApi24.addMessagingStyle(builder, mUserDisplayName,
+ mConversationTitle, texts, timestamps, senders,
+ dataMimeTypes, dataUris);
+ } else {
+ MessagingStyle.Message latestIncomingMessage = findLatestIncomingMessage();
+ // Set the title
+ if (mConversationTitle != null) {
+ builder.getBuilder().setContentTitle(mConversationTitle);
+ } else if (latestIncomingMessage != null) {
+ builder.getBuilder().setContentTitle(latestIncomingMessage.getSender());
+ }
+ // Set the text
+ if (latestIncomingMessage != null) {
+ builder.getBuilder().setContentText(mConversationTitle != null
+ ? makeMessageLine(latestIncomingMessage)
+ : latestIncomingMessage.getText());
+ }
+ // Build a fallback BigTextStyle for API 16-23 devices
+ if (Build.VERSION.SDK_INT >= 16) {
+ SpannableStringBuilder completeMessage = new SpannableStringBuilder();
+ boolean showNames = mConversationTitle != null
+ || hasMessagesWithoutSender();
+ for (int i = mMessages.size() - 1; i >= 0; i--) {
+ MessagingStyle.Message message = mMessages.get(i);
+ CharSequence line;
+ line = showNames ? makeMessageLine(message) : message.getText();
+ if (i != mMessages.size() - 1) {
+ completeMessage.insert(0, "\n");
+ }
+ completeMessage.insert(0, line);
+ }
+ NotificationCompatJellybean.addBigTextStyle(builder,
+ null,
+ false,
+ null,
+ completeMessage);
+ }
+ }
+ }
+
+ @Nullable
+ private MessagingStyle.Message findLatestIncomingMessage() {
+ for (int i = mMessages.size() - 1; i >= 0; i--) {
+ MessagingStyle.Message message = mMessages.get(i);
+ // Incoming messages have a non-empty sender.
+ if (!TextUtils.isEmpty(message.getSender())) {
+ return message;
+ }
+ }
+ if (!mMessages.isEmpty()) {
+ // No incoming messages, fall back to outgoing message
+ return mMessages.get(mMessages.size() - 1);
+ }
+ return null;
+ }
+
+ private boolean hasMessagesWithoutSender() {
+ for (int i = mMessages.size() - 1; i >= 0; i--) {
+ MessagingStyle.Message message = mMessages.get(i);
+ if (message.getSender() == null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private CharSequence makeMessageLine(MessagingStyle.Message message) {
+ BidiFormatter bidi = BidiFormatter.getInstance();
+ SpannableStringBuilder sb = new SpannableStringBuilder();
+ final boolean afterLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
+ int color = afterLollipop ? Color.BLACK : Color.WHITE;
+ CharSequence replyName = message.getSender();
+ if (TextUtils.isEmpty(message.getSender())) {
+ replyName = mUserDisplayName == null
+ ? "" : mUserDisplayName;
+ color = afterLollipop && mBuilder.getColor() != NotificationCompat.COLOR_DEFAULT
+ ? mBuilder.getColor()
+ : color;
+ }
+ CharSequence senderText = bidi.unicodeWrap(replyName);
+ sb.append(senderText);
+ sb.setSpan(makeFontColorSpan(color),
+ sb.length() - senderText.length(),
+ sb.length(),
+ Spanned.SPAN_EXCLUSIVE_EXCLUSIVE /* flags */);
+ CharSequence text = message.getText() == null ? "" : message.getText();
+ sb.append(" ").append(bidi.unicodeWrap(text));
+ return sb;
+ }
+
+ @NonNull
+ private TextAppearanceSpan makeFontColorSpan(int color) {
+ return new TextAppearanceSpan(null, 0, 0, ColorStateList.valueOf(color), null);
+ }
+
@Override
public void addCompatExtras(Bundle extras) {
super.addCompatExtras(extras);
@@ -2514,7 +2660,7 @@
* @see Notification#bigContentView
*/
public static class InboxStyle extends Style {
- ArrayList<CharSequence> mTexts = new ArrayList<CharSequence>();
+ private ArrayList<CharSequence> mTexts = new ArrayList<CharSequence>();
public InboxStyle() {
}
@@ -2548,6 +2694,21 @@
mTexts.add(Builder.limitCharSequenceLength(cs));
return this;
}
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public void apply(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 16) {
+ NotificationCompatJellybean.addInboxStyle(builder,
+ mBigContentTitle,
+ mSummaryTextSet,
+ mSummaryText,
+ mTexts);
+ }
+ }
}
/**
@@ -4415,12 +4576,6 @@
}
}
- /** @deprecated removed from API 26 */
- @Deprecated
- public static String getChannel(Notification notification) {
- return getChannelId(notification);
- }
-
/**
* Returns the time at which this notification should be canceled by the system, if it's not
* canceled already.
@@ -4433,12 +4588,6 @@
}
}
- /** @deprecated removed from API 26 */
- @Deprecated
- public static long getTimeout(Notification notification) {
- return getTimeoutAfter(notification);
- }
-
/**
* Returns what icon should be shown for this notification if it is being displayed in a
* Launcher that supports badging. Will be one of {@link #BADGE_ICON_NONE},
diff --git a/core-utils/java/android/support/v4/text/BidiFormatter.java b/compat/java/android/support/v4/text/BidiFormatter.java
similarity index 100%
rename from core-utils/java/android/support/v4/text/BidiFormatter.java
rename to compat/java/android/support/v4/text/BidiFormatter.java
diff --git a/compat/tests/java/android/support/v4/app/NotificationCompatTest.java b/compat/tests/java/android/support/v4/app/NotificationCompatTest.java
index e7c6f13..dd870dd 100644
--- a/compat/tests/java/android/support/v4/app/NotificationCompatTest.java
+++ b/compat/tests/java/android/support/v4/app/NotificationCompatTest.java
@@ -85,12 +85,12 @@
public void testTimeout() throws Throwable {
long timeout = 23552;
Notification n = new NotificationCompat.Builder(mActivityTestRule.getActivity())
- .setTimeout(timeout)
+ .setTimeoutAfter(timeout)
.build();
if (Build.VERSION.SDK_INT >= 26) {
- assertEquals(timeout, NotificationCompat.getTimeout(n));
+ assertEquals(timeout, NotificationCompat.getTimeoutAfter(n));
} else {
- assertEquals(0, NotificationCompat.getTimeout(n));
+ assertEquals(0, NotificationCompat.getTimeoutAfter(n));
}
}
@@ -111,12 +111,12 @@
public void testNotificationChannel() throws Throwable {
String channelId = "new ID";
Notification n = new NotificationCompat.Builder(mActivityTestRule.getActivity())
- .setChannel(channelId)
+ .setChannelId(channelId)
.build();
if (Build.VERSION.SDK_INT >= 26) {
- assertEquals(channelId, NotificationCompat.getChannel(n));
+ assertEquals(channelId, NotificationCompat.getChannelId(n));
} else {
- assertNull(NotificationCompat.getChannel(n));
+ assertNull(NotificationCompat.getChannelId(n));
}
}
@@ -126,9 +126,9 @@
Notification n = new NotificationCompat.Builder(mActivityTestRule.getActivity(), channelId)
.build();
if (Build.VERSION.SDK_INT >= 26) {
- assertEquals(channelId, NotificationCompat.getChannel(n));
+ assertEquals(channelId, NotificationCompat.getChannelId(n));
} else {
- assertNull(NotificationCompat.getChannel(n));
+ assertNull(NotificationCompat.getChannelId(n));
}
}
@@ -179,6 +179,18 @@
assertEquals(a.getAllowGeneratedReplies(), aCopy.getAllowGeneratedReplies());
}
+ @SdkSuppress(minSdkVersion = 24)
+ @TargetApi(24)
+ @Test
+ public void testFrameworkNotificationActionBuilder_setAllowGeneratedRepliesTrue()
+ throws Throwable {
+ Notification notif = new Notification.Builder(mContext)
+ .addAction(new Notification.Action.Builder(0, "title", null)
+ .setAllowGeneratedReplies(true).build()).build();
+ NotificationCompat.Action action = NotificationCompat.getAction(notif, 0);
+ assertTrue(action.getAllowGeneratedReplies());
+ }
+
@Test
public void testNotificationActionBuilder_defaultAllowGeneratedRepliesTrue() throws Throwable {
NotificationCompat.Action a = newActionBuilder().build();
diff --git a/compat/tests/java/android/support/v4/graphics/PaintCompatHasGlyphTest.java b/compat/tests/java/android/support/v4/graphics/PaintCompatHasGlyphTest.java
index 26f0691..f17c881 100644
--- a/compat/tests/java/android/support/v4/graphics/PaintCompatHasGlyphTest.java
+++ b/compat/tests/java/android/support/v4/graphics/PaintCompatHasGlyphTest.java
@@ -47,6 +47,7 @@
{"\t\t\t", false}, // more white space
{"☺", SDK_INT >= 16}, // glyph added in API 16
{"\uD83D\uDC66\uD83C\uDFFF", SDK_INT >= 24}, // glyph added in API 24
+ {"\uD83C\uDDEF\uD83C\uDDF5", SDK_INT >= 20}, // Japan flag emoji, added in API 20
});
}
diff --git a/core-utils/tests/java/android/support/v4/text/BidiFormatterTest.java b/compat/tests/java/android/support/v4/text/BidiFormatterTest.java
similarity index 100%
rename from core-utils/tests/java/android/support/v4/text/BidiFormatterTest.java
rename to compat/tests/java/android/support/v4/text/BidiFormatterTest.java
diff --git a/core-ui/java/android/support/v4/widget/DrawerLayout.java b/core-ui/java/android/support/v4/widget/DrawerLayout.java
index 3b3a781..c7b40e9 100644
--- a/core-ui/java/android/support/v4/widget/DrawerLayout.java
+++ b/core-ui/java/android/support/v4/widget/DrawerLayout.java
@@ -148,7 +148,8 @@
*/
public static final int LOCK_MODE_UNDEFINED = 3;
- @IntDef({Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END})
+ @IntDef(value = {Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END},
+ flag = true)
@Retention(RetentionPolicy.SOURCE)
private @interface EdgeGravity {}
diff --git a/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java b/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java
index c949cbb..e3f2462 100644
--- a/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java
+++ b/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java
@@ -477,7 +477,7 @@
}
int layoutHeight = 0;
- int maxLayoutHeight = -1;
+ int maxLayoutHeight = 0;
switch (heightMode) {
case MeasureSpec.EXACTLY:
layoutHeight = maxLayoutHeight = heightSize - getPaddingTop() - getPaddingBottom();
diff --git a/core-ui/lint-baseline.xml b/core-ui/lint-baseline.xml
index 1c675b0..493c8c5 100644
--- a/core-ui/lint-baseline.xml
+++ b/core-ui/lint-baseline.xml
@@ -2,102 +2,14 @@
<issues format="4" by="lint 2.4.0-alpha6">
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
</issues>
diff --git a/core-utils/java/android/support/v4/content/WakefulBroadcastReceiver.java b/core-utils/java/android/support/v4/content/WakefulBroadcastReceiver.java
index b960939..b0cd653 100644
--- a/core-utils/java/android/support/v4/content/WakefulBroadcastReceiver.java
+++ b/core-utils/java/android/support/v4/content/WakefulBroadcastReceiver.java
@@ -70,8 +70,7 @@
public abstract class WakefulBroadcastReceiver extends BroadcastReceiver {
private static final String EXTRA_WAKE_LOCK_ID = "android.support.content.wakelockid";
- private static final SparseArray<PowerManager.WakeLock> mActiveWakeLocks
- = new SparseArray<PowerManager.WakeLock>();
+ private static final SparseArray<PowerManager.WakeLock> sActiveWakeLocks = new SparseArray<>();
private static int mNextId = 1;
/**
@@ -89,7 +88,7 @@
* Context.startService}.
*/
public static ComponentName startWakefulService(Context context, Intent intent) {
- synchronized (mActiveWakeLocks) {
+ synchronized (sActiveWakeLocks) {
int id = mNextId;
mNextId++;
if (mNextId <= 0) {
@@ -106,8 +105,8 @@
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
"wake:" + comp.flattenToShortString());
wl.setReferenceCounted(false);
- wl.acquire(60*1000);
- mActiveWakeLocks.put(id, wl);
+ wl.acquire(60 * 1000);
+ sActiveWakeLocks.put(id, wl);
return comp;
}
}
@@ -125,11 +124,11 @@
if (id == 0) {
return false;
}
- synchronized (mActiveWakeLocks) {
- PowerManager.WakeLock wl = mActiveWakeLocks.get(id);
+ synchronized (sActiveWakeLocks) {
+ PowerManager.WakeLock wl = sActiveWakeLocks.get(id);
if (wl != null) {
wl.release();
- mActiveWakeLocks.remove(id);
+ sActiveWakeLocks.remove(id);
return true;
}
// We return true whether or not we actually found the wake lock
@@ -138,7 +137,7 @@
// We just log a warning here if there is no wake lock found, which could
// happen for example if this function is called twice on the same
// intent or the process is killed and restarted before processing the intent.
- Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);
+ Log.w("WakefulBroadcastReceiv.", "No active wake lock id #" + id);
return true;
}
}
diff --git a/core-utils/java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java b/core-utils/java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java
index 5efc74b..5e144c7 100644
--- a/core-utils/java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java
+++ b/core-utils/java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java
@@ -31,7 +31,7 @@
* either from Bitmaps directly, or from streams and files.
*/
public final class RoundedBitmapDrawableFactory {
- private static final String TAG = "RoundedBitmapDrawableFactory";
+ private static final String TAG = "RoundedBitmapDrawableFa";
private static class DefaultRoundedBitmapDrawable extends RoundedBitmapDrawable {
DefaultRoundedBitmapDrawable(Resources res, Bitmap bitmap) {
diff --git a/core-utils/lint-baseline.xml b/core-utils/lint-baseline.xml
index d75d39e..172bbf6 100644
--- a/core-utils/lint-baseline.xml
+++ b/core-utils/lint-baseline.xml
@@ -1,37 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="4" by="lint 2.4.0-alpha6">
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
</issues>
diff --git a/design/lint-baseline.xml b/design/lint-baseline.xml
index 7ece01b..6cd8289 100644
--- a/design/lint-baseline.xml
+++ b/design/lint-baseline.xml
@@ -94,17 +94,6 @@
</issue>
<issue
- id="ResourceType"
- message="Expected resource of type xml"
- errorLine1=" final XmlPullParser parser = res.getXml(resId);"
- errorLine2=" ~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="557"
- column="53"/>
- </issue>
-
- <issue
id="Range"
message="Value must be ≥ 0 (was -2147483648)"
errorLine1=" MeasureSpec.makeMeasureSpec(largestChildHeight,"
@@ -127,72 +116,6 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="LongLogTag"
message="The logging tag can be at most 23 characters, was 30 (ActionBarDrawerToggleHoneycomb)"
errorLine1=" Log.w(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", e);"
@@ -292,171 +215,6 @@
</issue>
<issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "found saved state: " + mPendingSavedState);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="783"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Deciding anchor info from fresh state");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="828"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "invalid saved state class");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1187"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "saved state:\n" + state);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1236"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "FILLING targetLine: " + targetLine + ",""
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1559"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "assigned " + currentSpan.mIndex + " for " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1580"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "using " + spanIndex + " for pos " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1584"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "asked " + dt + " scrolled" + totalScroll);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2153"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Unknown focus request:" + focusDirection);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2385"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="AppCompatCustomView"
message="This custom view should extend `android.support.v7.widget.AppCompatAutoCompleteTextView` instead"
errorLine1="public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements"
@@ -633,21 +391,6 @@
</issue>
<issue
- id="UniqueConstants"
- message="Constants `FLAG_CVE_EQ_PVE` and `FLAG_CVE_EQ_PVE` specify the same exact value (8192); this is usually a cut & paste or merge error"
- errorLine1=" FLAG_CVE_EQ_PVE, FLAG_CVE_EQ_PVE, FLAG_CVE_LT_PVE"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="30"/>
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="13"/>
- </issue>
-
- <issue
id="WrongConstant"
message="Must be one of: PixelFormat.UNKNOWN, PixelFormat.TRANSLUCENT, PixelFormat.TRANSPARENT, PixelFormat.OPAQUE"
errorLine1=" return 0;"
@@ -660,35 +403,13 @@
<issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
<issue
@@ -713,15 +434,4 @@
column="36"/>
</issue>
- <issue
- id="WrongConstant"
- message="Must be one of: View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL"
- errorLine1=" return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="821"
- column="64"/>
- </issue>
-
</issues>
diff --git a/dynamic-animation/lint-baseline.xml b/dynamic-animation/lint-baseline.xml
index d75d39e..172bbf6 100644
--- a/dynamic-animation/lint-baseline.xml
+++ b/dynamic-animation/lint-baseline.xml
@@ -1,37 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="4" by="lint 2.4.0-alpha6">
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
</issues>
diff --git a/emoji/appcompat/lint-baseline.xml b/emoji/appcompat/lint-baseline.xml
index 91d58da..3b6c11d 100644
--- a/emoji/appcompat/lint-baseline.xml
+++ b/emoji/appcompat/lint-baseline.xml
@@ -94,17 +94,6 @@
</issue>
<issue
- id="ResourceType"
- message="Expected resource of type xml"
- errorLine1=" final XmlPullParser parser = res.getXml(resId);"
- errorLine2=" ~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="557"
- column="53"/>
- </issue>
-
- <issue
id="Range"
message="Value must be ≥ 0 (was -2147483648)"
errorLine1=" MeasureSpec.makeMeasureSpec(largestChildHeight,"
@@ -127,72 +116,6 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="LongLogTag"
message="The logging tag can be at most 23 characters, was 30 (ActionBarDrawerToggleHoneycomb)"
errorLine1=" Log.w(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", e);"
@@ -292,72 +215,6 @@
</issue>
<issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="AppCompatCustomView"
message="This custom view should extend `android.support.v7.widget.AppCompatAutoCompleteTextView` instead"
errorLine1="public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements"
@@ -579,35 +436,13 @@
<issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
<issue
@@ -632,15 +467,4 @@
column="36"/>
</issue>
- <issue
- id="WrongConstant"
- message="Must be one of: View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL"
- errorLine1=" return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="821"
- column="64"/>
- </issue>
-
</issues>
diff --git a/fragment/java/android/support/v4/app/FragmentStatePagerAdapter.java b/fragment/java/android/support/v4/app/FragmentStatePagerAdapter.java
index 7aa3d20..fc27c4f 100644
--- a/fragment/java/android/support/v4/app/FragmentStatePagerAdapter.java
+++ b/fragment/java/android/support/v4/app/FragmentStatePagerAdapter.java
@@ -62,7 +62,7 @@
* complete}
*/
public abstract class FragmentStatePagerAdapter extends PagerAdapter {
- private static final String TAG = "FragmentStatePagerAdapter";
+ private static final String TAG = "FragmentStatePagerAdapt";
private static final boolean DEBUG = false;
private final FragmentManager mFragmentManager;
diff --git a/fragment/lint-baseline.xml b/fragment/lint-baseline.xml
index 2a79d28..4d3d334 100644
--- a/fragment/lint-baseline.xml
+++ b/fragment/lint-baseline.xml
@@ -24,168 +24,14 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
</issues>
diff --git a/gradle.properties b/gradle.properties
index d1c2c14..b8e17ca 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,6 @@
org.gradle.jvmargs=-Xmx4g
org.gradle.daemon=true
org.gradle.configureondemand=true
-org.gradle.parallel=true
\ No newline at end of file
+org.gradle.parallel=true
+org.gradle.caching=true
+android.useDexArchive=false
diff --git a/graphics/drawable/animated/lint-baseline.xml b/graphics/drawable/animated/lint-baseline.xml
index a3f6f77..42fb119 100644
--- a/graphics/drawable/animated/lint-baseline.xml
+++ b/graphics/drawable/animated/lint-baseline.xml
@@ -13,124 +13,14 @@
</issue>
<issue
- id="ResourceType"
- message="Expected resource of type xml"
- errorLine1=" final XmlPullParser parser = res.getXml(resId);"
- errorLine2=" ~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="557"
- column="53"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL"
- errorLine1=" return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="821"
- column="64"/>
+ line="1075"
+ column="47"/>
</issue>
</issues>
diff --git a/graphics/drawable/static/lint-baseline.xml b/graphics/drawable/static/lint-baseline.xml
index 2809a1e..172bbf6 100644
--- a/graphics/drawable/static/lint-baseline.xml
+++ b/graphics/drawable/static/lint-baseline.xml
@@ -1,26 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="4" by="lint 2.4.0-alpha6">
- <issue
- id="ResourceType"
- message="Expected resource of type xml"
- errorLine1=" final XmlPullParser parser = res.getXml(resId);"
- errorLine2=" ~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="557"
- column="53"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL"
- errorLine1=" return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="821"
- column="64"/>
- </issue>
-
</issues>
diff --git a/graphics/drawable/static/src/android/support/graphics/drawable/VectorDrawableCompat.java b/graphics/drawable/static/src/android/support/graphics/drawable/VectorDrawableCompat.java
index f9753eb..b68ef1b 100644
--- a/graphics/drawable/static/src/android/support/graphics/drawable/VectorDrawableCompat.java
+++ b/graphics/drawable/static/src/android/support/graphics/drawable/VectorDrawableCompat.java
@@ -16,6 +16,7 @@
import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+import android.annotation.SuppressLint;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
@@ -554,7 +555,7 @@
}
try {
- final XmlPullParser parser = res.getXml(resId);
+ @SuppressLint("ResourceType") final XmlPullParser parser = res.getXml(resId);
final AttributeSet attrs = Xml.asAttributeSet(parser);
int type;
while ((type = parser.next()) != XmlPullParser.START_TAG &&
@@ -818,7 +819,8 @@
// We don't support RTL auto mirroring since the getLayoutDirection() is for API 17+.
private boolean needMirroring() {
if (Build.VERSION.SDK_INT >= 17) {
- return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;
+ return isAutoMirrored()
+ && DrawableCompat.getLayoutDirection(this) == LayoutDirection.RTL;
} else {
return false;
}
diff --git a/media-compat/java/android/support/v4/media/MediaBrowserCompat.java b/media-compat/java/android/support/v4/media/MediaBrowserCompat.java
index 93ee3e0..3c62f94 100644
--- a/media-compat/java/android/support/v4/media/MediaBrowserCompat.java
+++ b/media-compat/java/android/support/v4/media/MediaBrowserCompat.java
@@ -945,9 +945,10 @@
void subscribe(@NonNull String parentId, Bundle options,
@NonNull SubscriptionCallback callback);
void unsubscribe(@NonNull String parentId, SubscriptionCallback callback);
- void getItem(final @NonNull String mediaId, @NonNull final ItemCallback cb);
+ void getItem(@NonNull String mediaId, @NonNull ItemCallback cb);
void search(@NonNull String query, Bundle extras, @NonNull SearchCallback callback);
- void sendCustomAction(String action, Bundle extras, final CustomActionCallback callback);
+ void sendCustomAction(@NonNull String action, Bundle extras,
+ @Nullable CustomActionCallback callback);
}
interface MediaBrowserServiceCallbackImpl {
@@ -1289,12 +1290,14 @@
} catch (RemoteException e) {
Log.i(TAG, "Remote error sending a custom action: action=" + action + ", extras="
+ extras, e);
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- callback.onError(action, extras, null);
- }
- });
+ if (callback != null) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onError(action, extras, null);
+ }
+ });
+ }
}
}
@@ -1803,8 +1806,8 @@
}
@Override
- public void sendCustomAction(final String action, final Bundle extras,
- final CustomActionCallback callback) {
+ public void sendCustomAction(@NonNull final String action, final Bundle extras,
+ @Nullable final CustomActionCallback callback) {
if (!isConnected()) {
throw new IllegalStateException("Cannot send a custom action (" + action + ") with "
+ "extras " + extras + " because the browser is not connected to the "
@@ -1812,12 +1815,14 @@
}
if (mServiceBinderWrapper == null) {
Log.i(TAG, "The connected service doesn't support sendCustomAction.");
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- callback.onError(action, extras, null);
- }
- });
+ if (callback != null) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onError(action, extras, null);
+ }
+ });
+ }
}
ResultReceiver receiver = new CustomActionResultReceiver(action, extras, callback,
@@ -1828,12 +1833,14 @@
} catch (RemoteException e) {
Log.i(TAG, "Remote error sending a custom action: action=" + action + ", extras="
+ extras, e);
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- callback.onError(action, extras, null);
- }
- });
+ if (callback != null) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onError(action, extras, null);
+ }
+ });
+ }
}
}
diff --git a/media-compat/java/android/support/v4/media/session/MediaControllerCompat.java b/media-compat/java/android/support/v4/media/session/MediaControllerCompat.java
index 47bef3b..cfe13b3 100644
--- a/media-compat/java/android/support/v4/media/session/MediaControllerCompat.java
+++ b/media-compat/java/android/support/v4/media/session/MediaControllerCompat.java
@@ -241,7 +241,7 @@
}
/**
- * Get a {@link TransportControls} instance for this session.
+ * Gets a {@link TransportControls} instance for this session.
*
* @return A controls instance
*/
@@ -250,7 +250,7 @@
}
/**
- * Send the specified media button event to the session. Only media keys can
+ * Sends the specified media button event to the session. Only media keys can
* be sent by this method, other keys will be ignored.
*
* @param keyEvent The media button event to dispatch.
@@ -264,7 +264,7 @@
}
/**
- * Get the current playback state for this session.
+ * Gets the current playback state for this session.
*
* @return The current PlaybackState or null
*/
@@ -273,7 +273,7 @@
}
/**
- * Get the current metadata for this session.
+ * Gets the current metadata for this session.
*
* @return The current MediaMetadata or null.
*/
@@ -282,7 +282,7 @@
}
/**
- * Get the current play queue for this session if one is set. If you only
+ * Gets the current play queue for this session if one is set. If you only
* care about the current item {@link #getMetadata()} should be used.
*
* @return The current play queue or null.
@@ -292,7 +292,7 @@
}
/**
- * Add a queue item from the given {@code description} at the end of the play queue
+ * Adds a queue item from the given {@code description} at the end of the play queue
* of this session. Not all sessions may support this. To know whether the session supports
* this, get the session's flags with {@link #getFlags()} and check that the flag
* {@link MediaSessionCompat#FLAG_HANDLES_QUEUE_COMMANDS} is set.
@@ -308,7 +308,7 @@
}
/**
- * Add a queue item from the given {@code description} at the specified position
+ * Adds a queue item from the given {@code description} at the specified position
* in the play queue of this session. Shifts the queue item currently at that position
* (if any) and any subsequent queue items to the right (adds one to their indices).
* Not all sessions may support this. To know whether the session supports this,
@@ -328,7 +328,7 @@
}
/**
- * Remove the first occurrence of the specified {@link MediaSessionCompat.QueueItem}
+ * Removes the first occurrence of the specified {@link MediaSessionCompat.QueueItem}
* with the given {@link MediaDescriptionCompat description} in the play queue of the
* associated session. Not all sessions may support this. To know whether the session supports
* this, get the session's flags with {@link #getFlags()} and check that the flag
@@ -345,7 +345,7 @@
}
/**
- * Remove an queue item at the specified position in the play queue
+ * Removes an queue item at the specified position in the play queue
* of this session. Not all sessions may support this. To know whether the session supports
* this, get the session's flags with {@link #getFlags()} and check that the flag
* {@link MediaSessionCompat#FLAG_HANDLES_QUEUE_COMMANDS} is set.
@@ -368,21 +368,21 @@
}
/**
- * Get the queue title for this session.
+ * Gets the queue title for this session.
*/
public CharSequence getQueueTitle() {
return mImpl.getQueueTitle();
}
/**
- * Get the extras for this session.
+ * Gets the extras for this session.
*/
public Bundle getExtras() {
return mImpl.getExtras();
}
/**
- * Get the rating type supported by the session. One of:
+ * Gets the rating type supported by the session. One of:
* <ul>
* <li>{@link RatingCompat#RATING_NONE}</li>
* <li>{@link RatingCompat#RATING_HEART}</li>
@@ -400,7 +400,7 @@
}
/**
- * Return whether captioning is enabled for this session.
+ * Returns whether captioning is enabled for this session.
*
* @return {@code true} if captioning is enabled, {@code false} if disabled or not set.
*/
@@ -409,7 +409,7 @@
}
/**
- * Get the repeat mode for this session.
+ * Gets the repeat mode for this session.
*
* @return The latest repeat mode set to the session, or
* {@link PlaybackStateCompat#REPEAT_MODE_NONE} if not set.
@@ -419,7 +419,7 @@
}
/**
- * Return whether the shuffle mode is enabled for this session.
+ * Returns whether the shuffle mode is enabled for this session.
*
* @return {@code true} if the shuffle mode is enabled, {@code false} if disabled or not set.
* @deprecated Use {@link #getShuffleMode} instead.
@@ -430,7 +430,7 @@
}
/**
- * Get the shuffle mode for this session.
+ * Gets the shuffle mode for this session.
*
* @return The latest shuffle mode set to the session, or
* {@link PlaybackStateCompat#SHUFFLE_MODE_NONE} if not set.
@@ -440,7 +440,7 @@
}
/**
- * Get the flags for this session. Flags are defined in
+ * Gets the flags for this session. Flags are defined in
* {@link MediaSessionCompat}.
*
* @return The current set of flags for the session.
@@ -450,7 +450,7 @@
}
/**
- * Get the current playback info for this session.
+ * Gets the current playback info for this session.
*
* @return The current playback info or null.
*/
@@ -459,7 +459,7 @@
}
/**
- * Get an intent for launching UI associated with this session if one
+ * Gets an intent for launching UI associated with this session if one
* exists.
*
* @return A {@link PendingIntent} to launch UI or null.
@@ -469,7 +469,7 @@
}
/**
- * Get the token for the session this controller is connected to.
+ * Gets the token for the session this controller is connected to.
*
* @return The session's token.
*/
@@ -478,7 +478,7 @@
}
/**
- * Set the volume of the output this session is playing on. The command will
+ * Sets the volume of the output this session is playing on. The command will
* be ignored if it does not support
* {@link VolumeProviderCompat#VOLUME_CONTROL_ABSOLUTE}. The flags in
* {@link AudioManager} may be used to affect the handling.
@@ -493,7 +493,7 @@
}
/**
- * Adjust the volume of the output this session is playing on. The direction
+ * Adjusts the volume of the output this session is playing on. The direction
* must be one of {@link AudioManager#ADJUST_LOWER},
* {@link AudioManager#ADJUST_RAISE}, or {@link AudioManager#ADJUST_SAME}.
* The command will be ignored if the session does not support
@@ -538,7 +538,7 @@
}
/**
- * Stop receiving updates on the specified callback. If an update has
+ * Stops receiving updates on the specified callback. If an update has
* already been posted you may still receive it after calling this method.
*
* @param callback The callback to remove
@@ -567,7 +567,7 @@
}
/**
- * Get the session owner's package name.
+ * Gets the session owner's package name.
*
* @return The package name of of the session owner.
*/
@@ -665,7 +665,7 @@
}
/**
- * Override to handle chagnes to the {@link MediaSessionCompat} extras.
+ * Override to handle changes to the {@link MediaSessionCompat} extras.
*
* @param extras The extras that can include other information
* associated with the {@link MediaSessionCompat}.
@@ -728,7 +728,7 @@
}
/**
- * Set the handler to use for pre 21 callbacks.
+ * Sets the handler to use for pre 21 callbacks.
*/
private void setHandler(Handler handler) {
mHandler = new MessageHandler(handler.getLooper());
@@ -1040,7 +1040,7 @@
public abstract void playFromUri(Uri uri, Bundle extras);
/**
- * Play an item with a specific id in the play queue. If you specify an
+ * Plays an item with a specific id in the play queue. If you specify an
* id that is not in the play queue, the behavior is undefined.
*/
public abstract void skipToQueueItem(long id);
@@ -1058,36 +1058,36 @@
public abstract void stop();
/**
- * Move to a new location in the media stream.
+ * Moves to a new location in the media stream.
*
* @param pos Position to move to, in milliseconds.
*/
public abstract void seekTo(long pos);
/**
- * Start fast forwarding. If playback is already fast forwarding this
+ * Starts fast forwarding. If playback is already fast forwarding this
* may increase the rate.
*/
public abstract void fastForward();
/**
- * Skip to the next item.
+ * Skips to the next item.
*/
public abstract void skipToNext();
/**
- * Start rewinding. If playback is already rewinding this may increase
+ * Starts rewinding. If playback is already rewinding this may increase
* the rate.
*/
public abstract void rewind();
/**
- * Skip to the previous item.
+ * Skips to the previous item.
*/
public abstract void skipToPrevious();
/**
- * Rate the current content. This will cause the rating to be set for
+ * Rates the current content. This will cause the rating to be set for
* the current user. The Rating type must match the type returned by
* {@link #getRatingType()}.
*
@@ -1096,14 +1096,14 @@
public abstract void setRating(RatingCompat rating);
/**
- * Enable/disable captioning for this session.
+ * Enables/disables captioning for this session.
*
* @param enabled {@code true} to enable captioning, {@code false} to disable.
*/
public abstract void setCaptioningEnabled(boolean enabled);
/**
- * Set the repeat mode for this session.
+ * Sets the repeat mode for this session.
*
* @param repeatMode The repeat mode. Must be one of the followings:
* {@link PlaybackStateCompat#REPEAT_MODE_NONE},
@@ -1114,7 +1114,7 @@
public abstract void setRepeatMode(@PlaybackStateCompat.RepeatMode int repeatMode);
/**
- * Set the shuffle mode for this session.
+ * Sets the shuffle mode for this session.
*
* @param enabled {@code true} to enable the shuffle mode, {@code false} to disable.
* @deprecated Use {@link #setShuffleMode} instead.
@@ -1123,7 +1123,7 @@
public abstract void setShuffleModeEnabled(boolean enabled);
/**
- * Set the shuffle mode for this session.
+ * Sets the shuffle mode for this session.
*
* @param shuffleMode The shuffle mode. Must be one of the followings:
* {@link PlaybackStateCompat#SHUFFLE_MODE_NONE},
@@ -1133,7 +1133,7 @@
public abstract void setShuffleMode(@PlaybackStateCompat.ShuffleMode int shuffleMode);
/**
- * Send a custom action for the {@link MediaSessionCompat} to perform.
+ * Sends a custom action for the {@link MediaSessionCompat} to perform.
*
* @param customAction The action to perform.
* @param args Optional arguments to supply to the
@@ -1143,7 +1143,7 @@
Bundle args);
/**
- * Send the id and args from a custom action for the
+ * Sends the id and args from a custom action for the
* {@link MediaSessionCompat} to perform.
*
* @see #sendCustomAction(PlaybackStateCompat.CustomAction action,
@@ -1190,7 +1190,7 @@
}
/**
- * Get the type of volume handling, either local or remote. One of:
+ * Gets the type of volume handling, either local or remote. One of:
* <ul>
* <li>{@link PlaybackInfo#PLAYBACK_TYPE_LOCAL}</li>
* <li>{@link PlaybackInfo#PLAYBACK_TYPE_REMOTE}</li>
@@ -1203,7 +1203,7 @@
}
/**
- * Get the stream this is currently controlling volume on. When the volume
+ * Gets the stream this is currently controlling volume on. When the volume
* type is {@link PlaybackInfo#PLAYBACK_TYPE_REMOTE} this value does not
* have meaning and should be ignored.
*
@@ -1215,7 +1215,7 @@
}
/**
- * Get the type of volume control that can be used. One of:
+ * Gets the type of volume control that can be used. One of:
* <ul>
* <li>{@link VolumeProviderCompat#VOLUME_CONTROL_ABSOLUTE}</li>
* <li>{@link VolumeProviderCompat#VOLUME_CONTROL_RELATIVE}</li>
@@ -1230,7 +1230,7 @@
}
/**
- * Get the maximum volume that may be set for this session.
+ * Gets the maximum volume that may be set for this session.
*
* @return The maximum allowed volume where this session is playing.
*/
@@ -1239,7 +1239,7 @@
}
/**
- * Get the current volume for this session.
+ * Gets the current volume for this session.
*
* @return The current volume where this session is playing.
*/
diff --git a/media-compat/java/android/support/v4/media/session/MediaSessionCompat.java b/media-compat/java/android/support/v4/media/session/MediaSessionCompat.java
index ecc2dbc..5df4b72 100644
--- a/media-compat/java/android/support/v4/media/session/MediaSessionCompat.java
+++ b/media-compat/java/android/support/v4/media/session/MediaSessionCompat.java
@@ -115,19 +115,19 @@
public @interface SessionFlags {}
/**
- * Set this flag on the session to indicate that it can handle media button
+ * Sets this flag on the session to indicate that it can handle media button
* events.
*/
public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1 << 0;
/**
- * Set this flag on the session to indicate that it handles transport
+ * Sets this flag on the session to indicate that it handles transport
* control commands through its {@link Callback}.
*/
public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 1 << 1;
/**
- * Set this flag on the session to indicate that it handles queue
+ * Sets this flag on the session to indicate that it handles queue
* management commands through its {@link Callback}.
*/
public static final int FLAG_HANDLES_QUEUE_COMMANDS = 1 << 2;
@@ -435,7 +435,7 @@
}
/**
- * Add a callback to receive updates on for the MediaSession. This includes
+ * Adds a callback to receive updates on for the MediaSession. This includes
* media button and volume events. The caller's thread will be used to post
* events.
*
@@ -446,7 +446,7 @@
}
/**
- * Set the callback to receive updates for the MediaSession. This includes
+ * Sets the callback to receive updates for the MediaSession. This includes
* media button and volume events. Set the callback to null to stop
* receiving events.
*
@@ -458,7 +458,7 @@
}
/**
- * Set an intent for launching UI for this Session. This can be used as a
+ * Sets an intent for launching UI for this Session. This can be used as a
* quick link to an ongoing media screen. The intent should be for an
* activity that may be started using
* {@link Activity#startActivity(Intent)}.
@@ -470,7 +470,7 @@
}
/**
- * Set a pending intent for your media button receiver to allow restarting
+ * Sets a pending intent for your media button receiver to allow restarting
* playback after the session has been stopped. If your app is started in
* this way an {@link Intent#ACTION_MEDIA_BUTTON} intent will be sent via
* the pending intent.
@@ -487,7 +487,7 @@
}
/**
- * Set any flags for the session.
+ * Sets any flags for the session.
*
* @param flags The flags to set for this session.
*/
@@ -496,7 +496,7 @@
}
/**
- * Set the stream this session is playing on. This will affect the system's
+ * Sets the stream this session is playing on. This will affect the system's
* volume handling for this session. If {@link #setPlaybackToRemote} was
* previously called it will stop receiving volume commands and the system
* will begin sending volume changes to the appropriate stream.
@@ -510,7 +510,7 @@
}
/**
- * Configure this session to use remote volume handling. This must be called
+ * Configures this session to use remote volume handling. This must be called
* to receive volume button events, otherwise the system will adjust the
* current stream volume for this session. If {@link #setPlaybackToLocal}
* was previously called that stream will stop receiving volume changes for
@@ -532,7 +532,7 @@
}
/**
- * Set if this session is currently active and ready to receive commands. If
+ * Sets if this session is currently active and ready to receive commands. If
* set to false your session's controller may not be discoverable. You must
* set the session to active before it can start receiving media button
* events or transport commands.
@@ -552,7 +552,7 @@
}
/**
- * Get the current active state of this session.
+ * Gets the current active state of this session.
*
* @return True if the session is active, false otherwise.
*/
@@ -561,7 +561,7 @@
}
/**
- * Send a proprietary event to all MediaControllers listening to this
+ * Sends a proprietary event to all MediaControllers listening to this
* Session. It's up to the Controller/Session owner to determine the meaning
* of any events.
*
@@ -585,7 +585,7 @@
}
/**
- * Retrieve a token object that can be used by apps to create a
+ * Retrieves a token object that can be used by apps to create a
* {@link MediaControllerCompat} for interacting with this session. The
* owner of the session is responsible for deciding how to distribute these
* tokens.
@@ -603,7 +603,7 @@
}
/**
- * Get a controller for this session. This is a convenience method to avoid
+ * Gets a controller for this session. This is a convenience method to avoid
* having to cache your own controller in process.
*
* @return A controller for this session.
@@ -613,7 +613,7 @@
}
/**
- * Update the current playback state.
+ * Updates the current playback state.
*
* @param state The current state of playback
*/
@@ -622,7 +622,7 @@
}
/**
- * Update the current metadata. New metadata can be created using
+ * Updates the current metadata. New metadata can be created using
* {@link android.support.v4.media.MediaMetadataCompat.Builder}. This operation may take time
* proportional to the size of the bitmap to replace large bitmaps with a scaled down copy.
*
@@ -634,7 +634,7 @@
}
/**
- * Update the list of items in the play queue. It is an ordered list and
+ * Updates the list of items in the play queue. It is an ordered list and
* should contain the current item, and previous or upcoming items if they
* exist. Specify null if there is no current play queue.
* <p>
@@ -649,7 +649,7 @@
}
/**
- * Set the title of the play queue. The UI should display this title along
+ * Sets the title of the play queue. The UI should display this title along
* with the play queue itself. e.g. "Play Queue", "Now Playing", or an album
* name.
*
@@ -660,7 +660,7 @@
}
/**
- * Set the style of rating used by this session. Apps trying to set the
+ * Sets the style of rating used by this session. Apps trying to set the
* rating should use this style. Must be one of the following:
* <ul>
* <li>{@link RatingCompat#RATING_NONE}</li>
@@ -677,7 +677,7 @@
}
/**
- * Enable/disable captioning for this session.
+ * Enables/disables captioning for this session.
*
* @param enabled {@code true} to enable captioning, {@code false} to disable.
*/
@@ -686,7 +686,7 @@
}
/**
- * Set the repeat mode for this session.
+ * Sets the repeat mode for this session.
* <p>
* Note that if this method is not called before, {@link MediaControllerCompat#getRepeatMode}
* will return {@link PlaybackStateCompat#REPEAT_MODE_NONE}.
@@ -702,7 +702,7 @@
}
/**
- * Set the shuffle mode for this session.
+ * Sets the shuffle mode for this session.
* <p>
* Note that if this method is not called before,
* {@link MediaControllerCompat#isShuffleModeEnabled} will return {@code false}.
@@ -716,7 +716,7 @@
}
/**
- * Set the shuffle mode for this session.
+ * Sets the shuffle mode for this session.
* <p>
* Note that if this method is not called before, {@link MediaControllerCompat#getShuffleMode}
* will return {@link PlaybackStateCompat#SHUFFLE_MODE_NONE}.
@@ -731,7 +731,7 @@
}
/**
- * Set some extras that can be associated with the
+ * Sets some extras that can be associated with the
* {@link MediaSessionCompat}. No assumptions should be made as to how a
* {@link MediaControllerCompat} will handle these extras. Keys should be
* fully qualified (e.g. com.example.MY_EXTRA) to avoid conflicts.
@@ -867,7 +867,7 @@
final Object mCallbackObj;
private WeakReference<MediaSessionImpl> mSessionImpl;
private CallbackHandler mCallbackHandler = null;
- private boolean mMediaPlayPauseKeyHandled;
+ private boolean mMediaPlayPauseKeyPending;
public Callback() {
if (android.os.Build.VERSION.SDK_INT >= 24) {
@@ -924,42 +924,45 @@
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
case KeyEvent.KEYCODE_HEADSETHOOK:
if (keyEvent.getRepeatCount() > 0) {
+ // Consider long-press as a single tap.
+ handleMediaPlayPauseKeySingleTapIfPending();
+ } else if (mMediaPlayPauseKeyPending) {
mCallbackHandler.removeMessages(
CallbackHandler.MSG_MEDIA_PLAY_PAUSE_KEY_DOUBLE_TAP_TIMEOUT);
- if (keyEvent.getRepeatCount() == 1) {
- handleMediaPlayPauseKeySingleTapIfUnhandled();
- }
- } else if (mCallbackHandler.hasMessages(
- CallbackHandler.MSG_MEDIA_PLAY_PAUSE_KEY_DOUBLE_TAP_TIMEOUT)) {
- mCallbackHandler.removeMessages(
- CallbackHandler.MSG_MEDIA_PLAY_PAUSE_KEY_DOUBLE_TAP_TIMEOUT);
+ mMediaPlayPauseKeyPending = false;
PlaybackStateCompat state = impl.getPlaybackState();
long validActions = state == null ? 0 : state.getActions();
// Consider double tap as the next.
if ((validActions & PlaybackStateCompat.ACTION_SKIP_TO_NEXT) != 0) {
onSkipToNext();
}
- mMediaPlayPauseKeyHandled = true;
} else {
- mMediaPlayPauseKeyHandled = false;
+ mMediaPlayPauseKeyPending = true;
mCallbackHandler.sendEmptyMessageDelayed(
CallbackHandler.MSG_MEDIA_PLAY_PAUSE_KEY_DOUBLE_TAP_TIMEOUT,
ViewConfiguration.getDoubleTapTimeout());
}
return true;
+ default:
+ // If another key is pressed within double tap timeout, consider the pending
+ // pending play/pause as a single tap to handle media keys in order.
+ handleMediaPlayPauseKeySingleTapIfPending();
+ break;
}
return false;
}
- private void handleMediaPlayPauseKeySingleTapIfUnhandled() {
- if (mMediaPlayPauseKeyHandled) {
+ private void handleMediaPlayPauseKeySingleTapIfPending() {
+ if (!mMediaPlayPauseKeyPending) {
return;
}
+ mMediaPlayPauseKeyPending = false;
+ mCallbackHandler.removeMessages(
+ CallbackHandler.MSG_MEDIA_PLAY_PAUSE_KEY_DOUBLE_TAP_TIMEOUT);
MediaSessionImpl impl = mSessionImpl.get();
if (impl == null) {
return;
}
- mMediaPlayPauseKeyHandled = true;
PlaybackStateCompat state = impl.getPlaybackState();
long validActions = state == null ? 0 : state.getActions();
boolean isPlaying = state != null
@@ -1230,7 +1233,7 @@
@Override
public void handleMessage(Message msg) {
if (msg.what == MSG_MEDIA_PLAY_PAUSE_KEY_DOUBLE_TAP_TIMEOUT) {
- handleMediaPlayPauseKeySingleTapIfUnhandled();
+ handleMediaPlayPauseKeySingleTapIfPending();
}
}
}
@@ -1585,7 +1588,7 @@
private Object mItem;
/**
- * Create a new {@link MediaSessionCompat.QueueItem}.
+ * Creates a new {@link MediaSessionCompat.QueueItem}.
*
* @param description The {@link MediaDescriptionCompat} for this item.
* @param id An identifier for this item. It must be unique within the
@@ -1613,14 +1616,14 @@
}
/**
- * Get the description for this item.
+ * Gets the description for this item.
*/
public MediaDescriptionCompat getDescription() {
return mDescription;
}
/**
- * Get the queue id for this item.
+ * Gets the queue id for this item.
*/
public long getQueueId() {
return mId;
@@ -1638,7 +1641,7 @@
}
/**
- * Get the underlying
+ * Gets the underlying
* {@link android.media.session.MediaSession.QueueItem}.
* <p>
* On builds before {@link android.os.Build.VERSION_CODES#LOLLIPOP} null
diff --git a/media-compat/tests/src/android/support/v4/media/MediaBrowserServiceCompatTest.java b/media-compat/tests/src/android/support/v4/media/MediaBrowserServiceCompatTest.java
index 4856cfd..4ceac10 100644
--- a/media-compat/tests/src/android/support/v4/media/MediaBrowserServiceCompatTest.java
+++ b/media-compat/tests/src/android/support/v4/media/MediaBrowserServiceCompatTest.java
@@ -378,7 +378,6 @@
assertEquals(val, browserRoot.getExtras().getString(key));
}
-
@Test
@SmallTest
public void testDelayedSetSessionToken() throws Exception {
@@ -583,6 +582,5 @@
mWaitLock.notify();
}
}
- };
-
+ }
}
diff --git a/media-compat/tests/src/android/support/v4/media/session/MediaSessionCompatTest.java b/media-compat/tests/src/android/support/v4/media/session/MediaSessionCompatTest.java
index a3744cc..b44a085 100644
--- a/media-compat/tests/src/android/support/v4/media/session/MediaSessionCompatTest.java
+++ b/media-compat/tests/src/android/support/v4/media/session/MediaSessionCompatTest.java
@@ -600,18 +600,8 @@
PendingIntent pi = PendingIntent.getBroadcast(getContext(), 0, mediaButtonIntent, 0);
mSession.setMediaButtonReceiver(pi);
- long supportedActions = PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE
- | PlaybackStateCompat.ACTION_PLAY_PAUSE | PlaybackStateCompat.ACTION_STOP
- | PlaybackStateCompat.ACTION_SKIP_TO_NEXT
- | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS
- | PlaybackStateCompat.ACTION_FAST_FORWARD | PlaybackStateCompat.ACTION_REWIND;
-
// Set state to STATE_PLAYING to get higher priority.
- PlaybackStateCompat defaultState = new PlaybackStateCompat.Builder()
- .setActions(supportedActions)
- .setState(PlaybackStateCompat.STATE_PLAYING, 0L, 0.0f)
- .build();
- mSession.setPlaybackState(defaultState);
+ setPlaybackState(PlaybackStateCompat.STATE_PLAYING);
sessionCallback.reset(1);
sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY);
@@ -651,24 +641,21 @@
// Test PLAY_PAUSE button twice.
// First, send PLAY_PAUSE button event while in STATE_PAUSED.
sessionCallback.reset(1);
- mSession.setPlaybackState(new PlaybackStateCompat.Builder().setActions(supportedActions)
- .setState(PlaybackStateCompat.STATE_PAUSED, 0L, 0.0f).build());
+ setPlaybackState(PlaybackStateCompat.STATE_PAUSED);
sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
assertTrue(sessionCallback.await(TIME_OUT_MS));
assertEquals(1, sessionCallback.mOnPlayCalledCount);
// Next, send PLAY_PAUSE button event while in STATE_PLAYING.
sessionCallback.reset(1);
- mSession.setPlaybackState(new PlaybackStateCompat.Builder().setActions(supportedActions)
- .setState(PlaybackStateCompat.STATE_PLAYING, 0L, 0.0f).build());
+ setPlaybackState(PlaybackStateCompat.STATE_PLAYING);
sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
assertTrue(sessionCallback.await(TIME_OUT_MS));
assertTrue(sessionCallback.mOnPauseCalled);
// Double tap of PLAY_PAUSE is the next track.
sessionCallback.reset(2);
- mSession.setPlaybackState(new PlaybackStateCompat.Builder().setActions(supportedActions)
- .setState(PlaybackStateCompat.STATE_PAUSED, 0L, 0.0f).build());
+ setPlaybackState(PlaybackStateCompat.STATE_PAUSED);
sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
assertFalse(sessionCallback.await(WAIT_TIME_MS));
@@ -679,8 +666,7 @@
// Test PLAY_PAUSE button long-press.
// It should be the same as the single short-press.
sessionCallback.reset(1);
- mSession.setPlaybackState(new PlaybackStateCompat.Builder().setActions(supportedActions)
- .setState(PlaybackStateCompat.STATE_PAUSED, 0L, 0.0f).build());
+ setPlaybackState(PlaybackStateCompat.STATE_PAUSED);
sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, true);
assertTrue(sessionCallback.await(TIME_OUT_MS));
assertEquals(1, sessionCallback.mOnPlayCalledCount);
@@ -700,16 +686,53 @@
// Initial long-press of the PLAY_PAUSE is considered as the single short-press already,
// so it shouldn't be used as the first tap of the double tap.
sessionCallback.reset(2);
- mSession.setPlaybackState(new PlaybackStateCompat.Builder().setActions(supportedActions)
- .setState(PlaybackStateCompat.STATE_PAUSED, 0L, 0.0f).build());
+ setPlaybackState(PlaybackStateCompat.STATE_PAUSED);
sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, true);
sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
assertTrue(sessionCallback.await(TIME_OUT_MS));
// onMediaButtonEvent() calls either onPlay() or onPause() depending on the playback state,
// so onPlay() should be called twice while onPause() isn't called.
- assertEquals(2, sessionCallback.mOnPlayCalledCount);
- assertFalse(sessionCallback.mOnPauseCalled);
+ assertEquals(1, sessionCallback.mOnPlayCalledCount);
+ assertTrue(sessionCallback.mOnPauseCalled);
assertFalse(sessionCallback.mOnSkipToNextCalled);
+
+ // If another media key is pressed while the double tap of PLAY_PAUSE,
+ // PLAY_PAUSE should be handles as normal.
+ sessionCallback.reset(3);
+ setPlaybackState(PlaybackStateCompat.STATE_PAUSED);
+ sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
+ sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_STOP);
+ sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
+ assertTrue(sessionCallback.await(TIME_OUT_MS));
+ assertFalse(sessionCallback.mOnSkipToNextCalled);
+ assertTrue(sessionCallback.mOnStopCalled);
+ assertEquals(2, sessionCallback.mOnPlayCalledCount);
+
+ // Test if media keys are handled in order.
+ sessionCallback.reset(2);
+ setPlaybackState(PlaybackStateCompat.STATE_PAUSED);
+ sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
+ sendMediaKeyInputToController(KeyEvent.KEYCODE_MEDIA_STOP);
+ assertTrue(sessionCallback.await(TIME_OUT_MS));
+ assertEquals(1, sessionCallback.mOnPlayCalledCount);
+ assertTrue(sessionCallback.mOnStopCalled);
+ synchronized (mWaitLock) {
+ assertEquals(PlaybackStateCompat.STATE_STOPPED,
+ mSession.getController().getPlaybackState().getState());
+ }
+ }
+
+ private void setPlaybackState(int state) {
+ final long allActions = PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE
+ | PlaybackStateCompat.ACTION_PLAY_PAUSE | PlaybackStateCompat.ACTION_STOP
+ | PlaybackStateCompat.ACTION_SKIP_TO_NEXT
+ | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS
+ | PlaybackStateCompat.ACTION_FAST_FORWARD | PlaybackStateCompat.ACTION_REWIND;
+ PlaybackStateCompat playbackState = new PlaybackStateCompat.Builder().setActions(allActions)
+ .setState(state, 0L, 0.0f).build();
+ synchronized (mWaitLock) {
+ mSession.setPlaybackState(playbackState);
+ }
}
@Test
@@ -995,18 +1018,21 @@
@Override
public void onPlay() {
mOnPlayCalledCount++;
+ setPlaybackState(PlaybackStateCompat.STATE_PLAYING);
mLatch.countDown();
}
@Override
public void onPause() {
mOnPauseCalled = true;
+ setPlaybackState(PlaybackStateCompat.STATE_PAUSED);
mLatch.countDown();
}
@Override
public void onStop() {
mOnStopCalled = true;
+ setPlaybackState(PlaybackStateCompat.STATE_STOPPED);
mLatch.countDown();
}
diff --git a/recommendation/lint-baseline.xml b/recommendation/lint-baseline.xml
index 2a79d28..4d3d334 100644
--- a/recommendation/lint-baseline.xml
+++ b/recommendation/lint-baseline.xml
@@ -24,168 +24,14 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
</issues>
diff --git a/settings.gradle b/settings.gradle
index dd3db92..ffc34ee 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -94,9 +94,6 @@
include ':support-tv-provider'
project(':support-tv-provider').projectDir = new File(rootDir, 'tv-provider')
-include ':support-instantvideo'
-project(':support-instantvideo').projectDir = new File(rootDir, 'instantvideo')
-
include ':support-emoji'
project(':support-emoji').projectDir = new File(rootDir, 'emoji/core')
diff --git a/transition/lint-baseline.xml b/transition/lint-baseline.xml
index 2a79d28..4d3d334 100644
--- a/transition/lint-baseline.xml
+++ b/transition/lint-baseline.xml
@@ -24,168 +24,14 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
</issues>
diff --git a/v13/lint-baseline.xml b/v13/lint-baseline.xml
index 2a79d28..4d3d334 100644
--- a/v13/lint-baseline.xml
+++ b/v13/lint-baseline.xml
@@ -24,168 +24,14 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
</issues>
diff --git a/v14/preference/lint-baseline.xml b/v14/preference/lint-baseline.xml
index 65f542a..adeb0d6 100644
--- a/v14/preference/lint-baseline.xml
+++ b/v14/preference/lint-baseline.xml
@@ -94,17 +94,6 @@
</issue>
<issue
- id="ResourceType"
- message="Expected resource of type xml"
- errorLine1=" final XmlPullParser parser = res.getXml(resId);"
- errorLine2=" ~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="557"
- column="53"/>
- </issue>
-
- <issue
id="Range"
message="Value must be ≥ 0 (was -2147483648)"
errorLine1=" MeasureSpec.makeMeasureSpec(largestChildHeight,"
@@ -127,72 +116,6 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="Suspicious0dp"
message="Suspicious size: this will make the view invisible, should be used with `layout_weight`"
errorLine1=" android:layout_width="0dp""
@@ -347,171 +270,6 @@
</issue>
<issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "found saved state: " + mPendingSavedState);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="783"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Deciding anchor info from fresh state");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="828"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "invalid saved state class");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1187"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "saved state:\n" + state);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1236"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "FILLING targetLine: " + targetLine + ",""
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1559"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "assigned " + currentSpan.mIndex + " for " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1580"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "using " + spanIndex + " for pos " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1584"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "asked " + dt + " scrolled" + totalScroll);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2153"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Unknown focus request:" + focusDirection);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2385"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="AppCompatCustomView"
message="This custom view should extend `android.support.v7.widget.AppCompatAutoCompleteTextView` instead"
errorLine1="public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements"
@@ -688,21 +446,6 @@
</issue>
<issue
- id="UniqueConstants"
- message="Constants `FLAG_CVE_EQ_PVE` and `FLAG_CVE_EQ_PVE` specify the same exact value (8192); this is usually a cut & paste or merge error"
- errorLine1=" FLAG_CVE_EQ_PVE, FLAG_CVE_EQ_PVE, FLAG_CVE_LT_PVE"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="30"/>
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="13"/>
- </issue>
-
- <issue
id="WrongConstant"
message="Must be one of: PixelFormat.UNKNOWN, PixelFormat.TRANSLUCENT, PixelFormat.TRANSPARENT, PixelFormat.OPAQUE"
errorLine1=" return 0;"
@@ -715,35 +458,13 @@
<issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
<issue
@@ -768,15 +489,4 @@
column="36"/>
</issue>
- <issue
- id="WrongConstant"
- message="Must be one of: View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL"
- errorLine1=" return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="821"
- column="64"/>
- </issue>
-
</issues>
diff --git a/v17/leanback/lint-baseline.xml b/v17/leanback/lint-baseline.xml
index d87e4b2..24cb762 100644
--- a/v17/leanback/lint-baseline.xml
+++ b/v17/leanback/lint-baseline.xml
@@ -57,72 +57,6 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="LongLogTag"
message="The logging tag can be at most 23 characters, was 27 (DetailsOverviewRowPresenter)"
errorLine1=" if (DEBUG) Log.v(TAG, "onLayoutChange " + v);"
@@ -146,39 +80,6 @@
<issue
id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
message="The logging tag can be at most 23 characters, was 36 (FullWidthDetailsOverviewRowPresenter)"
errorLine1=" if (DEBUG) Log.v(TAG, "onLayoutChange " + v);"
errorLine2=" ~~~">
@@ -206,7 +107,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="641"
+ line="642"
column="19"/>
</issue>
@@ -217,7 +118,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="999"
+ line="1000"
column="26"/>
</issue>
@@ -228,7 +129,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="1038"
+ line="1039"
column="26"/>
</issue>
@@ -239,7 +140,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="1237"
+ line="1239"
column="26"/>
</issue>
@@ -250,7 +151,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="1350"
+ line="1352"
column="30"/>
</issue>
@@ -261,7 +162,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="1362"
+ line="1364"
column="23"/>
</issue>
@@ -399,127 +300,6 @@
<issue
id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "found saved state: " + mPendingSavedState);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="783"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Deciding anchor info from fresh state");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="828"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "invalid saved state class");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1187"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "saved state:\n" + state);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1236"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "FILLING targetLine: " + targetLine + ",""
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1559"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "assigned " + currentSpan.mIndex + " for " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1580"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "using " + spanIndex + " for pos " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1584"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "asked " + dt + " scrolled" + totalScroll);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2153"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Unknown focus request:" + focusDirection);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2385"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
message="The logging tag can be at most 23 characters, was 27 (VerticalGridSupportFragment)"
errorLine1=" if (DEBUG) Log.v(TAG, "grid selected position " + position);"
errorLine2=" ~~~">
@@ -530,32 +310,6 @@
</issue>
<issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
- id="UniqueConstants"
- message="Constants `FLAG_CVE_EQ_PVE` and `FLAG_CVE_EQ_PVE` specify the same exact value (8192); this is usually a cut & paste or merge error"
- errorLine1=" FLAG_CVE_EQ_PVE, FLAG_CVE_EQ_PVE, FLAG_CVE_LT_PVE"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="30"/>
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="13"/>
- </issue>
-
- <issue
id="Orientation"
message="No orientation specified, and the default is horizontal. This is a common source of bugs when children are added dynamically."
errorLine1=" <LinearLayout"
@@ -590,35 +344,13 @@
<issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
<issue
@@ -639,7 +371,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~">
<location
file="src/android/support/v17/leanback/widget/GridLayoutManager.java"
- line="3468"
+ line="3476"
column="45"/>
</issue>
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java b/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
index d4e694a..748c993 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
@@ -3315,6 +3315,15 @@
return count == 0 || mBaseGridView.findViewHolderForAdapterPosition(0) != null;
}
+ boolean isItemFullyVisible(int pos) {
+ RecyclerView.ViewHolder vh = mBaseGridView.findViewHolderForAdapterPosition(pos);
+ if (vh == null) {
+ return false;
+ }
+ return vh.itemView.getLeft() >= 0 && vh.itemView.getRight() < mBaseGridView.getWidth()
+ && vh.itemView.getTop() >= 0 && vh.itemView.getBottom() < mBaseGridView.getHeight();
+ }
+
boolean canScrollTo(View view) {
return view.getVisibility() == View.VISIBLE && (!hasFocus() || view.hasFocusable());
}
@@ -3609,11 +3618,10 @@
saveContext(recycler, state);
switch (action) {
case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD:
- // try to focus all the way to the last visible item on the same row.
- processSelectionMoves(false, -mState.getItemCount());
+ processSelectionMoves(false, -1);
break;
case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD:
- processSelectionMoves(false, mState.getItemCount());
+ processSelectionMoves(false, 1);
break;
}
leaveContext();
@@ -3678,11 +3686,12 @@
public void onInitializeAccessibilityNodeInfo(Recycler recycler, State state,
AccessibilityNodeInfoCompat info) {
saveContext(recycler, state);
- if (mScrollEnabled && !hasCreatedFirstItem()) {
+ int count = state.getItemCount();
+ if (mScrollEnabled && count > 1 && !isItemFullyVisible(0)) {
info.addAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD);
info.setScrollable(true);
}
- if (mScrollEnabled && !hasCreatedLastItem()) {
+ if (mScrollEnabled && count > 1 && !isItemFullyVisible(count - 1)) {
info.addAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD);
info.setScrollable(true);
}
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/WindowAlignment.java b/v17/leanback/src/android/support/v17/leanback/widget/WindowAlignment.java
index a651b2e..3ddb6f0 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/WindowAlignment.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/WindowAlignment.java
@@ -254,27 +254,49 @@
}
}
if (!isMaxUnknown && !isMinUnknown) {
- if (!mReversedFlow ? (mWindowAlignment & WINDOW_ALIGN_LOW_EDGE) != 0
- : (mWindowAlignment & WINDOW_ALIGN_HIGH_EDGE) != 0) {
- if (!mReversedFlow ? isPreferKeylineOverLowEdge()
- : isPreferKeylineOverHighEdge()) {
- // if we prefer key line, might align max child to key line for minScroll
- mMinScroll = Math.min(mMinScroll,
- calculateScrollToKeyLine(maxChildViewCenter, keyLine));
- } else {
- // don't over scroll max
- mMaxScroll = Math.max(mMinScroll, mMaxScroll);
+ if (!mReversedFlow) {
+ if ((mWindowAlignment & WINDOW_ALIGN_LOW_EDGE) != 0) {
+ if (isPreferKeylineOverLowEdge()) {
+ // if we prefer key line, might align max child to key line for
+ // minScroll
+ mMinScroll = Math.min(mMinScroll,
+ calculateScrollToKeyLine(maxChildViewCenter, keyLine));
+ } else {
+ // don't over scroll max
+ mMaxScroll = Math.max(mMinScroll, mMaxScroll);
+ }
+ } else if ((mWindowAlignment & WINDOW_ALIGN_HIGH_EDGE) != 0) {
+ if (isPreferKeylineOverHighEdge()) {
+ // if we prefer key line, might align min child to key line for
+ // maxScroll
+ mMaxScroll = Math.max(mMaxScroll,
+ calculateScrollToKeyLine(minChildViewCenter, keyLine));
+ } else {
+ // don't over scroll min
+ mMinScroll = Math.min(mMinScroll, mMaxScroll);
+ }
}
- } else if (!mReversedFlow ? (mWindowAlignment & WINDOW_ALIGN_HIGH_EDGE) != 0
- : (mWindowAlignment & WINDOW_ALIGN_LOW_EDGE) != 0) {
- if (!mReversedFlow ? isPreferKeylineOverHighEdge()
- : isPreferKeylineOverLowEdge()) {
- // if we prefer key line, might align min child to key line for maxScroll
- mMaxScroll = Math.max(mMaxScroll,
- calculateScrollToKeyLine(minChildViewCenter, keyLine));
- } else {
- // don't over scroll min
- mMinScroll = Math.min(mMinScroll, mMaxScroll);
+ } else {
+ if ((mWindowAlignment & WINDOW_ALIGN_LOW_EDGE) != 0) {
+ if (isPreferKeylineOverLowEdge()) {
+ // if we prefer key line, might align min child to key line for
+ // maxScroll
+ mMaxScroll = Math.max(mMaxScroll,
+ calculateScrollToKeyLine(minChildViewCenter, keyLine));
+ } else {
+ // don't over scroll min
+ mMinScroll = Math.min(mMinScroll, mMaxScroll);
+ }
+ } else if ((mWindowAlignment & WINDOW_ALIGN_HIGH_EDGE) != 0) {
+ if (isPreferKeylineOverHighEdge()) {
+ // if we prefer key line, might align max child to key line for
+ // minScroll
+ mMinScroll = Math.min(mMinScroll,
+ calculateScrollToKeyLine(maxChildViewCenter, keyLine));
+ } else {
+ // don't over scroll max
+ mMaxScroll = Math.max(mMinScroll, mMaxScroll);
+ }
}
}
}
diff --git a/v17/leanback/tests/java/android/support/v17/leanback/widget/GridWidgetTest.java b/v17/leanback/tests/java/android/support/v17/leanback/widget/GridWidgetTest.java
index 1a173b4..86fb4eb 100644
--- a/v17/leanback/tests/java/android/support/v17/leanback/widget/GridWidgetTest.java
+++ b/v17/leanback/tests/java/android/support/v17/leanback/widget/GridWidgetTest.java
@@ -1419,6 +1419,27 @@
}
@Test
+ public void testItemMovedHorizontalRtl() throws Throwable {
+ Intent intent = new Intent();
+ intent.putExtra(GridActivity.EXTRA_LAYOUT_RESOURCE_ID,
+ R.layout.horizontal_linear_rtl);
+ intent.putExtra(GridActivity.EXTRA_STAGGERED, false);
+ intent.putExtra(GridActivity.EXTRA_ITEMS, new int[] {40, 40, 40});
+ initActivity(intent);
+ mOrientation = BaseGridView.HORIZONTAL;
+ mNumRows = 1;
+
+ performAndWaitForAnimation(new Runnable() {
+ @Override
+ public void run() {
+ mActivity.moveItem(0, 1, true);
+ }
+ });
+ assertEquals(mGridView.getWidth() - mGridView.getPaddingRight(),
+ mGridView.findViewHolderForAdapterPosition(0).itemView.getRight());
+ }
+
+ @Test
public void testScrollSecondaryCannotScroll() throws Throwable {
Intent intent = new Intent();
intent.putExtra(GridActivity.EXTRA_LAYOUT_RESOURCE_ID,
@@ -3888,6 +3909,108 @@
assertTrue(selectedPosition2 < selectedPosition1);
}
+ @Test
+ public void testAccessibilityScrollForwardHalfVisible() throws Throwable {
+ Intent intent = new Intent();
+ intent.putExtra(GridActivity.EXTRA_LAYOUT_RESOURCE_ID, R.layout.vertical_linear);
+ intent.putExtra(GridActivity.EXTRA_CHILD_LAYOUT_ID, R.layout.item_button_at_bottom);
+ intent.putExtra(GridActivity.EXTRA_ITEMS, new int[]{});
+ intent.putExtra(GridActivity.EXTRA_STAGGERED, false);
+ initActivity(intent);
+ mOrientation = BaseGridView.VERTICAL;
+ mNumRows = 1;
+
+ int height = mGridView.getHeight() - mGridView.getPaddingTop()
+ - mGridView.getPaddingBottom();
+ final int childHeight = height - mGridView.getVerticalSpacing() - 100;
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mGridView.setWindowAlignment(BaseGridView.WINDOW_ALIGN_NO_EDGE);
+ mGridView.setWindowAlignmentOffset(100);
+ mGridView.setWindowAlignmentOffsetPercent(BaseGridView
+ .WINDOW_ALIGN_OFFSET_PERCENT_DISABLED);
+ mGridView.setItemAlignmentOffset(0);
+ mGridView.setItemAlignmentOffsetPercent(BaseGridView
+ .ITEM_ALIGN_OFFSET_PERCENT_DISABLED);
+ }
+ });
+ mActivity.addItems(0, new int[]{childHeight, childHeight});
+ waitForItemAnimation();
+ setSelectedPosition(0);
+
+ final RecyclerViewAccessibilityDelegate delegateCompat = mGridView
+ .getCompatAccessibilityDelegate();
+ final AccessibilityNodeInfoCompat info = AccessibilityNodeInfoCompat.obtain();
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ delegateCompat.onInitializeAccessibilityNodeInfo(mGridView, info);
+ }
+ });
+ assertTrue("test sanity", info.isScrollable());
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ delegateCompat.performAccessibilityAction(mGridView,
+ AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD, null);
+ }
+ });
+ waitForScrollIdle(mVerifyLayout);
+ assertEquals(1, mGridView.getSelectedPosition());
+ }
+
+ @Test
+ public void testAccessibilityScrollBackwardHalfVisible() throws Throwable {
+ Intent intent = new Intent();
+ intent.putExtra(GridActivity.EXTRA_LAYOUT_RESOURCE_ID, R.layout.vertical_linear);
+ intent.putExtra(GridActivity.EXTRA_CHILD_LAYOUT_ID, R.layout.item_button_at_top);
+ intent.putExtra(GridActivity.EXTRA_ITEMS, new int[]{});
+ intent.putExtra(GridActivity.EXTRA_STAGGERED, false);
+ initActivity(intent);
+ mOrientation = BaseGridView.VERTICAL;
+ mNumRows = 1;
+
+ int height = mGridView.getHeight() - mGridView.getPaddingTop()
+ - mGridView.getPaddingBottom();
+ final int childHeight = height - mGridView.getVerticalSpacing() - 100;
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mGridView.setWindowAlignment(BaseGridView.WINDOW_ALIGN_NO_EDGE);
+ mGridView.setWindowAlignmentOffset(100);
+ mGridView.setWindowAlignmentOffsetPercent(BaseGridView
+ .WINDOW_ALIGN_OFFSET_PERCENT_DISABLED);
+ mGridView.setItemAlignmentOffset(0);
+ mGridView.setItemAlignmentOffsetPercent(BaseGridView
+ .ITEM_ALIGN_OFFSET_PERCENT_DISABLED);
+ }
+ });
+ mActivity.addItems(0, new int[]{childHeight, childHeight});
+ waitForItemAnimation();
+ setSelectedPosition(1);
+
+ final RecyclerViewAccessibilityDelegate delegateCompat = mGridView
+ .getCompatAccessibilityDelegate();
+ final AccessibilityNodeInfoCompat info = AccessibilityNodeInfoCompat.obtain();
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ delegateCompat.onInitializeAccessibilityNodeInfo(mGridView, info);
+ }
+ });
+ assertTrue("test sanity", info.isScrollable());
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ delegateCompat.performAccessibilityAction(mGridView,
+ AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD, null);
+ }
+ });
+ waitForScrollIdle(mVerifyLayout);
+ assertEquals(0, mGridView.getSelectedPosition());
+ }
+
void slideInAndWaitIdle() throws Throwable {
slideInAndWaitIdle(5000);
}
@@ -4884,14 +5007,14 @@
void prepareKeyLineTest(int numItems) throws Throwable {
Intent intent = new Intent();
- intent.putExtra(GridActivity.EXTRA_LAYOUT_RESOURCE_ID, R.layout.vertical_linear);
+ intent.putExtra(GridActivity.EXTRA_LAYOUT_RESOURCE_ID, R.layout.horizontal_linear);
int[] items = new int[numItems];
for (int i = 0; i < items.length; i++) {
items[i] = 32;
}
intent.putExtra(GridActivity.EXTRA_ITEMS, items);
intent.putExtra(GridActivity.EXTRA_STAGGERED, false);
- mOrientation = BaseGridView.VERTICAL;
+ mOrientation = BaseGridView.HORIZONTAL;
mNumRows = 1;
initActivity(intent);
@@ -4932,51 +5055,76 @@
final boolean preferKeyLineOverHigh,
ItemAt assertFirstItemLocation,
ItemAt assertLastItemLocation) throws Throwable {
+ TestPreferKeyLineOptions options = new TestPreferKeyLineOptions();
+ options.mAssertItemLocations = new ItemAt[] {assertFirstItemLocation,
+ assertLastItemLocation};
+ options.mPreferKeyLineOverLow = preferKeyLineOverLow;
+ options.mPreferKeyLineOverHigh = preferKeyLineOverHigh;
+ options.mWindowAlignment = windowAlignment;
+
+ options.mRtl = false;
+ testPreferKeyLine(options);
+
+ options.mRtl = true;
+ testPreferKeyLine(options);
+ }
+
+ static class TestPreferKeyLineOptions {
+ int mWindowAlignment;
+ boolean mPreferKeyLineOverLow;
+ boolean mPreferKeyLineOverHigh;
+ ItemAt[] mAssertItemLocations;
+ boolean mRtl;
+ }
+
+ public void testPreferKeyLine(final TestPreferKeyLineOptions options) throws Throwable {
startWaitLayout();
mActivityTestRule.runOnUiThread(new Runnable() {
@Override
public void run() {
- mGridView.setWindowAlignment(windowAlignment);
+ if (options.mRtl) {
+ mGridView.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
+ } else {
+ mGridView.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
+ }
+ mGridView.setWindowAlignment(options.mWindowAlignment);
mGridView.setWindowAlignmentOffsetPercent(50);
mGridView.setWindowAlignmentOffset(0);
- mGridView.setWindowAlignmentPreferKeyLineOverLowEdge(preferKeyLineOverLow);
- mGridView.setWindowAlignmentPreferKeyLineOverHighEdge(preferKeyLineOverHigh);
+ mGridView.setWindowAlignmentPreferKeyLineOverLowEdge(options.mPreferKeyLineOverLow);
+ mGridView.setWindowAlignmentPreferKeyLineOverHighEdge(
+ options.mPreferKeyLineOverHigh);
}
});
waitForLayout();
- final int lowPadding = mGridView.getPaddingTop();
- final int highPadding = mGridView.getHeight() - mGridView.getPaddingBottom();
- final int windowAlignCenter = mGridView.getHeight() / 2;
+ final int paddingStart = mGridView.getPaddingStart();
+ final int paddingEnd = mGridView.getPaddingEnd();
+ final int windowAlignCenter = mGridView.getWidth() / 2;
- setSelectedPosition(assertFirstItemLocation.mScrollPosition);
- View view = mGridView.findViewHolderForAdapterPosition(assertFirstItemLocation.mPosition)
- .itemView;
- switch (assertFirstItemLocation.mLocation) {
- case ITEM_AT_LOW:
- assertEquals(lowPadding, view.getTop());
- break;
- case ITEM_AT_HIGH:
- assertEquals(highPadding, view.getBottom());
- break;
- case ITEM_AT_KEY_LINE:
- assertEquals(windowAlignCenter, view.getTop() + view.getHeight() / 2, DELTA);
- break;
- }
-
- setSelectedPosition(assertLastItemLocation.mScrollPosition);
- view = mGridView.findViewHolderForAdapterPosition(assertLastItemLocation.mPosition)
- .itemView;
- switch (assertLastItemLocation.mLocation) {
- case ITEM_AT_LOW:
- assertEquals(lowPadding, view.getTop());
- break;
- case ITEM_AT_HIGH:
- assertEquals(highPadding, view.getBottom());
- break;
- case ITEM_AT_KEY_LINE:
- assertEquals(windowAlignCenter, view.getTop() + view.getHeight() / 2, DELTA);
- break;
+ for (int i = 0; i < options.mAssertItemLocations.length; i++) {
+ ItemAt assertItemLocation = options.mAssertItemLocations[i];
+ setSelectedPosition(assertItemLocation.mScrollPosition);
+ View view = mGridView.findViewHolderForAdapterPosition(assertItemLocation.mPosition)
+ .itemView;
+ switch (assertItemLocation.mLocation) {
+ case ITEM_AT_LOW:
+ if (options.mRtl) {
+ assertEquals(mGridView.getWidth() - paddingStart, view.getRight());
+ } else {
+ assertEquals(paddingStart, view.getLeft());
+ }
+ break;
+ case ITEM_AT_HIGH:
+ if (options.mRtl) {
+ assertEquals(paddingEnd, view.getLeft());
+ } else {
+ assertEquals(mGridView.getWidth() - paddingEnd, view.getRight());
+ }
+ break;
+ case ITEM_AT_KEY_LINE:
+ assertEquals(windowAlignCenter, (view.getLeft() + view.getRight()) / 2, DELTA);
+ break;
+ }
}
}
diff --git a/v17/leanback/tests/res/layout/item_button_at_bottom.xml b/v17/leanback/tests/res/layout/item_button_at_bottom.xml
new file mode 100644
index 0000000..8afc622
--- /dev/null
+++ b/v17/leanback/tests/res/layout/item_button_at_bottom.xml
@@ -0,0 +1,32 @@
+<!--
+ ~ Copyright (C) 2017 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.
+ -->
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="400dp"
+ android:layout_height="400dp"
+ >
+ <TextView
+ android:layout_alignParentTop="true"
+ android:text="unfocusable text"
+ android:layout_width="match_parent"
+ android:layout_height="50dp"/>
+ <Button
+ android:layout_alignParentBottom="true"
+ android:text="button"
+ android:focusable="true"
+ android:layout_width="match_parent"
+ android:layout_height="50dp"/>
+</RelativeLayout>
diff --git a/v17/leanback/tests/res/layout/item_button_at_top.xml b/v17/leanback/tests/res/layout/item_button_at_top.xml
new file mode 100644
index 0000000..5199193
--- /dev/null
+++ b/v17/leanback/tests/res/layout/item_button_at_top.xml
@@ -0,0 +1,33 @@
+<!--
+ ~ Copyright (C) 2017 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.
+ -->
+
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="400dp"
+ android:layout_height="400dp"
+ >
+ <TextView
+ android:layout_alignParentBottom="true"
+ android:text="unfocusable text"
+ android:layout_width="match_parent"
+ android:layout_height="50dp"/>
+ <Button
+ android:layout_alignParentTop="true"
+ android:text="button"
+ android:focusable="true"
+ android:layout_width="match_parent"
+ android:layout_height="50dp"/>
+</RelativeLayout>
diff --git a/v17/preference-leanback/lint-baseline.xml b/v17/preference-leanback/lint-baseline.xml
index 724d38a..923181b 100644
--- a/v17/preference-leanback/lint-baseline.xml
+++ b/v17/preference-leanback/lint-baseline.xml
@@ -127,17 +127,6 @@
</issue>
<issue
- id="ResourceType"
- message="Expected resource of type xml"
- errorLine1=" final XmlPullParser parser = res.getXml(resId);"
- errorLine2=" ~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="557"
- column="53"/>
- </issue>
-
- <issue
id="Range"
message="Value must be ≥ 0 (was -2147483648)"
errorLine1=" MeasureSpec.makeMeasureSpec(largestChildHeight,"
@@ -160,72 +149,6 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="Suspicious0dp"
message="Suspicious size: this will make the view invisible, should be used with `layout_weight`"
errorLine1=" <Space android:layout_width="0dp" android:layout_height="@dimen/lb_preference_item_text_space_top" />"
@@ -447,39 +370,6 @@
<issue
id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
message="The logging tag can be at most 23 characters, was 36 (FullWidthDetailsOverviewRowPresenter)"
errorLine1=" if (DEBUG) Log.v(TAG, "onLayoutChange " + v);"
errorLine2=" ~~~">
@@ -507,7 +397,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="641"
+ line="642"
column="19"/>
</issue>
@@ -518,7 +408,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="999"
+ line="1000"
column="26"/>
</issue>
@@ -529,7 +419,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="1038"
+ line="1039"
column="26"/>
</issue>
@@ -540,7 +430,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="1237"
+ line="1239"
column="26"/>
</issue>
@@ -551,7 +441,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="1350"
+ line="1352"
column="30"/>
</issue>
@@ -562,7 +452,7 @@
errorLine2=" ~~~">
<location
file="src/android/support/v17/leanback/app/GuidedStepSupportFragment.java"
- line="1362"
+ line="1364"
column="23"/>
</issue>
@@ -700,127 +590,6 @@
<issue
id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "found saved state: " + mPendingSavedState);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="783"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Deciding anchor info from fresh state");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="828"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "invalid saved state class");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1187"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "saved state:\n" + state);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1236"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "FILLING targetLine: " + targetLine + ",""
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1559"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "assigned " + currentSpan.mIndex + " for " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1580"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "using " + spanIndex + " for pos " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1584"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "asked " + dt + " scrolled" + totalScroll);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2153"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Unknown focus request:" + focusDirection);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2385"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
message="The logging tag can be at most 23 characters, was 27 (VerticalGridSupportFragment)"
errorLine1=" if (DEBUG) Log.v(TAG, "grid selected position " + position);"
errorLine2=" ~~~">
@@ -831,17 +600,6 @@
</issue>
<issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="AppCompatCustomView"
message="This custom view should extend `android.support.v7.widget.AppCompatAutoCompleteTextView` instead"
errorLine1="public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements"
@@ -1073,21 +831,6 @@
</issue>
<issue
- id="UniqueConstants"
- message="Constants `FLAG_CVE_EQ_PVE` and `FLAG_CVE_EQ_PVE` specify the same exact value (8192); this is usually a cut & paste or merge error"
- errorLine1=" FLAG_CVE_EQ_PVE, FLAG_CVE_EQ_PVE, FLAG_CVE_LT_PVE"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="30"/>
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="13"/>
- </issue>
-
- <issue
id="Orientation"
message="No orientation specified, and the default is horizontal. This is a common source of bugs when children are added dynamically."
errorLine1=" <LinearLayout"
@@ -1133,35 +876,13 @@
<issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
<issue
@@ -1182,7 +903,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~">
<location
file="src/android/support/v17/leanback/widget/GridLayoutManager.java"
- line="3468"
+ line="3476"
column="45"/>
</issue>
@@ -1231,17 +952,6 @@
</issue>
<issue
- id="WrongConstant"
- message="Must be one of: View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL"
- errorLine1=" return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="821"
- column="64"/>
- </issue>
-
- <issue
id="RtlCompat"
message="Inconsistent alignment specification between `textAlignment` and `gravity` attributes: was `center_vertical`, expected `start`"
errorLine1=" android:textAlignment="viewStart" />"
diff --git a/v4/lint-baseline.xml b/v4/lint-baseline.xml
index 2a79d28..4d3d334 100644
--- a/v4/lint-baseline.xml
+++ b/v4/lint-baseline.xml
@@ -24,168 +24,14 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
</issues>
diff --git a/v7/appcompat/lint-baseline.xml b/v7/appcompat/lint-baseline.xml
index 9436020..f0d1d20 100644
--- a/v7/appcompat/lint-baseline.xml
+++ b/v7/appcompat/lint-baseline.xml
@@ -94,17 +94,6 @@
</issue>
<issue
- id="ResourceType"
- message="Expected resource of type xml"
- errorLine1=" final XmlPullParser parser = res.getXml(resId);"
- errorLine2=" ~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="557"
- column="53"/>
- </issue>
-
- <issue
id="Range"
message="Value must be ≥ 0 (was -2147483648)"
errorLine1=" MeasureSpec.makeMeasureSpec(largestChildHeight,"
@@ -127,72 +116,6 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="LongLogTag"
message="The logging tag can be at most 23 characters, was 30 (ActionBarDrawerToggleHoneycomb)"
errorLine1=" Log.w(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", e);"
@@ -292,72 +215,6 @@
</issue>
<issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="WrongConstant"
message="Must be one of: PixelFormat.UNKNOWN, PixelFormat.TRANSLUCENT, PixelFormat.TRANSPARENT, PixelFormat.OPAQUE"
errorLine1=" return 0;"
@@ -370,35 +227,13 @@
<issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
<issue
@@ -423,15 +258,4 @@
column="36"/>
</issue>
- <issue
- id="WrongConstant"
- message="Must be one of: View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL"
- errorLine1=" return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="821"
- column="64"/>
- </issue>
-
</issues>
diff --git a/v7/appcompat/src/android/support/v7/app/NotificationCompat.java b/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
index 16840d2..0ec4c77 100644
--- a/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
+++ b/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
@@ -21,8 +21,7 @@
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
-import android.content.res.ColorStateList;
-import android.graphics.Color;
+import android.media.session.MediaSession;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
@@ -32,22 +31,12 @@
import android.support.v4.app.BundleCompat;
import android.support.v4.app.NotificationBuilderWithBuilderAccessor;
import android.support.v4.media.session.MediaSessionCompat;
-import android.support.v4.text.BidiFormatter;
import android.support.v7.appcompat.R;
-import android.text.SpannableStringBuilder;
-import android.text.Spanned;
-import android.text.TextUtils;
-import android.text.style.TextAppearanceSpan;
+import android.view.View;
import android.widget.RemoteViews;
-import java.util.List;
-
/**
- * An extension of {@link android.support.v4.app.NotificationCompat} which supports
- * {@link android.support.v7.app.NotificationCompat.MediaStyle},
- * {@link android.support.v7.app.NotificationCompat.DecoratedCustomViewStyle},
- * and {@link android.support.v7.app.NotificationCompat.DecoratedMediaCustomViewStyle}.
- * You should start using this variant if you need support any of these styles.
+ * An extension of {@link android.support.v4.app.NotificationCompat} which adds additional styles.
*/
public class NotificationCompat extends android.support.v4.app.NotificationCompat {
@@ -83,299 +72,8 @@
return null;
}
- @RequiresApi(24)
- private static void addStyleToBuilderApi24(NotificationBuilderWithBuilderAccessor builder,
- android.support.v4.app.NotificationCompat.Builder b) {
- if (b.mStyle instanceof DecoratedCustomViewStyle) {
- NotificationCompatImpl24.addDecoratedCustomViewStyle(builder);
- } else if (b.mStyle instanceof DecoratedMediaCustomViewStyle) {
- DecoratedMediaCustomViewStyle mediaStyle = (DecoratedMediaCustomViewStyle) b.mStyle;
- NotificationCompatImpl24.addDecoratedMediaCustomViewStyle(builder,
- mediaStyle.mActionsToShowInCompact,
- mediaStyle.mToken != null ? mediaStyle.mToken.getToken() : null);
- } else if (!(b.mStyle instanceof MessagingStyle)) {
- addStyleGetContentViewLollipop(builder, b);
- }
- }
-
- @RequiresApi(21)
- private static RemoteViews addStyleGetContentViewLollipop(
- NotificationBuilderWithBuilderAccessor builder,
- android.support.v4.app.NotificationCompat.Builder b) {
- if (b.mStyle instanceof MediaStyle) {
- MediaStyle mediaStyle = (MediaStyle) b.mStyle;
- NotificationCompatImpl21.addMediaStyle(builder,
- mediaStyle.mActionsToShowInCompact,
- mediaStyle.mToken != null ? mediaStyle.mToken.getToken() : null);
-
- boolean hasContentView = b.getContentView() != null;
- // If we are on L/M the media notification will only be colored if the expanded version
- // is of media style, so we have to create a custom view for the collapsed version as
- // well in that case.
- boolean isMorL = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
- && Build.VERSION.SDK_INT <= Build.VERSION_CODES.M;
- boolean createCustomContent = hasContentView
- || (isMorL && b.getBigContentView() != null);
- if (b.mStyle instanceof DecoratedMediaCustomViewStyle && createCustomContent) {
- RemoteViews contentViewMedia = NotificationCompatImplBase.overrideContentViewMedia(
- builder, b.mContext, b.mContentTitle, b.mContentText, b.mContentInfo,
- b.mNumber, b.mLargeIcon, b.mSubText, b.mUseChronometer,
- b.getWhenIfShowing(), b.getPriority(), b.mActions,
- mediaStyle.mActionsToShowInCompact, false /* no cancel button on L */,
- null /* cancelButtonIntent */, hasContentView /* isDecoratedCustomView */);
- if (hasContentView) {
- NotificationCompatImplBase.buildIntoRemoteViews(b.mContext, contentViewMedia,
- b.getContentView());
- }
- setBackgroundColor(b.mContext, contentViewMedia, b.getColor());
- return contentViewMedia;
- }
- return null;
- } else if (b.mStyle instanceof DecoratedCustomViewStyle) {
- return getDecoratedContentView(b);
- }
- return addStyleGetContentViewJellybean(builder, b);
- }
-
- @RequiresApi(16)
- private static RemoteViews addStyleGetContentViewJellybean(
- NotificationBuilderWithBuilderAccessor builder,
- android.support.v4.app.NotificationCompat.Builder b) {
- if (b.mStyle instanceof MessagingStyle) {
- addMessagingFallBackStyle((MessagingStyle) b.mStyle, builder, b);
- }
- return addStyleGetContentViewIcs(builder, b);
- }
-
- private static MessagingStyle.Message findLatestIncomingMessage(MessagingStyle style) {
- List<MessagingStyle.Message> messages = style.getMessages();
- for (int i = messages.size() - 1; i >= 0; i--) {
- MessagingStyle.Message m = messages.get(i);
- // Incoming messages have a non-empty sender.
- if (!TextUtils.isEmpty(m.getSender())) {
- return m;
- }
- }
- if (!messages.isEmpty()) {
- // No incoming messages, fall back to outgoing message
- return messages.get(messages.size() - 1);
- }
- return null;
- }
-
- private static CharSequence makeMessageLine(android.support.v4.app.NotificationCompat.Builder b,
- MessagingStyle style,
- MessagingStyle.Message m) {
- BidiFormatter bidi = BidiFormatter.getInstance();
- SpannableStringBuilder sb = new SpannableStringBuilder();
- boolean afterLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
- int color = afterLollipop || Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1
- ? Color.BLACK : Color.WHITE;
- CharSequence replyName = m.getSender();
- if (TextUtils.isEmpty(m.getSender())) {
- replyName = style.getUserDisplayName() == null
- ? "" : style.getUserDisplayName();
- color = afterLollipop && b.getColor() != NotificationCompat.COLOR_DEFAULT
- ? b.getColor()
- : color;
- }
- CharSequence senderText = bidi.unicodeWrap(replyName);
- sb.append(senderText);
- sb.setSpan(makeFontColorSpan(color),
- sb.length() - senderText.length(),
- sb.length(),
- Spanned.SPAN_EXCLUSIVE_EXCLUSIVE /* flags */);
- CharSequence text = m.getText() == null ? "" : m.getText();
- sb.append(" ").append(bidi.unicodeWrap(text));
- return sb;
- }
-
- private static TextAppearanceSpan makeFontColorSpan(int color) {
- return new TextAppearanceSpan(null, 0, 0, ColorStateList.valueOf(color), null);
- }
-
- @RequiresApi(16)
- private static void addMessagingFallBackStyle(MessagingStyle style,
- NotificationBuilderWithBuilderAccessor builder,
- android.support.v4.app.NotificationCompat.Builder b) {
- SpannableStringBuilder completeMessage = new SpannableStringBuilder();
- List<MessagingStyle.Message> messages = style.getMessages();
- boolean showNames = style.getConversationTitle() != null
- || hasMessagesWithoutSender(style.getMessages());
- for (int i = messages.size() - 1; i >= 0; i--) {
- MessagingStyle.Message m = messages.get(i);
- CharSequence line;
- line = showNames ? makeMessageLine(b, style, m) : m.getText();
- if (i != messages.size() - 1) {
- completeMessage.insert(0, "\n");
- }
- completeMessage.insert(0, line);
- }
- NotificationCompatImplJellybean.addBigTextStyle(builder, completeMessage);
- }
-
- private static boolean hasMessagesWithoutSender(
- List<MessagingStyle.Message> messages) {
- for (int i = messages.size() - 1; i >= 0; i--) {
- MessagingStyle.Message m = messages.get(i);
- if (m.getSender() == null) {
- return true;
- }
- }
- return false;
- }
-
- @RequiresApi(14)
- private static RemoteViews addStyleGetContentViewIcs(
- NotificationBuilderWithBuilderAccessor builder,
- android.support.v4.app.NotificationCompat.Builder b) {
- if (b.mStyle instanceof MediaStyle) {
- MediaStyle mediaStyle = (MediaStyle) b.mStyle;
- boolean isDecorated = b.mStyle instanceof DecoratedMediaCustomViewStyle
- && b.getContentView() != null;
- RemoteViews contentViewMedia = NotificationCompatImplBase.overrideContentViewMedia(
- builder, b.mContext, b.mContentTitle, b.mContentText, b.mContentInfo, b.mNumber,
- b.mLargeIcon, b.mSubText, b.mUseChronometer, b.getWhenIfShowing(),
- b.getPriority(), b.mActions, mediaStyle.mActionsToShowInCompact,
- mediaStyle.mShowCancelButton, mediaStyle.mCancelButtonIntent, isDecorated);
- if (isDecorated) {
- NotificationCompatImplBase.buildIntoRemoteViews(b.mContext, contentViewMedia,
- b.getContentView());
- return contentViewMedia;
- }
- } else if (b.mStyle instanceof DecoratedCustomViewStyle) {
- return getDecoratedContentView(b);
- }
- return null;
- }
-
- @RequiresApi(16)
- private static void addBigStyleToBuilderJellybean(Notification n,
- android.support.v4.app.NotificationCompat.Builder b) {
- if (b.mStyle instanceof MediaStyle) {
- MediaStyle mediaStyle = (MediaStyle) b.mStyle;
- RemoteViews innerView = b.getBigContentView() != null
- ? b.getBigContentView()
- : b.getContentView();
- boolean isDecorated = b.mStyle instanceof DecoratedMediaCustomViewStyle
- && innerView != null;
- NotificationCompatImplBase.overrideMediaBigContentView(n, b.mContext,
- b.mContentTitle, b.mContentText, b.mContentInfo, b.mNumber, b.mLargeIcon,
- b.mSubText, b.mUseChronometer, b.getWhenIfShowing(), b.getPriority(), 0,
- b.mActions, mediaStyle.mShowCancelButton, mediaStyle.mCancelButtonIntent,
- isDecorated);
- if (isDecorated) {
- NotificationCompatImplBase.buildIntoRemoteViews(b.mContext, n.bigContentView,
- innerView);
- }
- } else if (b.mStyle instanceof DecoratedCustomViewStyle) {
- addDecoratedBigStyleToBuilderJellybean(n, b);
- }
- }
-
- private static RemoteViews getDecoratedContentView(
- android.support.v4.app.NotificationCompat.Builder b) {
- if (b.getContentView() == null) {
- // No special content view
- return null;
- }
- RemoteViews remoteViews = NotificationCompatImplBase.applyStandardTemplateWithActions(
- b.mContext, b.mContentTitle, b.mContentText, b.mContentInfo, b.mNumber,
- b.mNotification.icon, b.mLargeIcon, b.mSubText, b.mUseChronometer,
- b.getWhenIfShowing(), b.getPriority(), b.getColor(),
- R.layout.notification_template_custom_big, false /* fitIn1U */, null /* actions */);
- NotificationCompatImplBase.buildIntoRemoteViews(b.mContext, remoteViews,
- b.getContentView());
- return remoteViews;
- }
-
- @RequiresApi(16)
- private static void addDecoratedBigStyleToBuilderJellybean(Notification n,
- android.support.v4.app.NotificationCompat.Builder b) {
- RemoteViews bigContentView = b.getBigContentView();
- RemoteViews innerView = bigContentView != null ? bigContentView : b.getContentView();
- if (innerView == null) {
- // No expandable notification
- return;
- }
- RemoteViews remoteViews = NotificationCompatImplBase.applyStandardTemplateWithActions(
- b.mContext, b.mContentTitle, b.mContentText, b.mContentInfo, b.mNumber,
- n.icon ,b.mLargeIcon, b.mSubText, b.mUseChronometer, b.getWhenIfShowing(),
- b.getPriority(), b.getColor(), R.layout.notification_template_custom_big,
- false /* fitIn1U */, b.mActions);
- NotificationCompatImplBase.buildIntoRemoteViews(b.mContext, remoteViews, innerView);
- n.bigContentView = remoteViews;
- }
-
- @RequiresApi(21)
- private static void addDecoratedHeadsUpToBuilderLollipop(Notification n,
- android.support.v4.app.NotificationCompat.Builder b) {
- RemoteViews headsUp = b.getHeadsUpContentView();
- RemoteViews innerView = headsUp != null ? headsUp : b.getContentView();
- if (headsUp == null) {
- // No expandable notification
- return;
- }
- RemoteViews remoteViews = NotificationCompatImplBase.applyStandardTemplateWithActions(
- b.mContext, b.mContentTitle, b.mContentText, b.mContentInfo, b.mNumber, n.icon,
- b.mLargeIcon, b.mSubText, b.mUseChronometer, b.getWhenIfShowing(), b.getPriority(),
- b.getColor(), R.layout.notification_template_custom_big, false /* fitIn1U */,
- b.mActions);
- NotificationCompatImplBase.buildIntoRemoteViews(b.mContext, remoteViews, innerView);
- n.headsUpContentView = remoteViews;
- }
-
- @RequiresApi(21)
- private static void addBigStyleToBuilderLollipop(Notification n,
- android.support.v4.app.NotificationCompat.Builder b) {
- RemoteViews innerView = b.getBigContentView() != null
- ? b.getBigContentView()
- : b.getContentView();
- if (b.mStyle instanceof DecoratedMediaCustomViewStyle && innerView != null) {
- NotificationCompatImplBase.overrideMediaBigContentView(n, b.mContext,
- b.mContentTitle, b.mContentText, b.mContentInfo, b.mNumber, b.mLargeIcon,
- b.mSubText, b.mUseChronometer, b.getWhenIfShowing(), b.getPriority(), 0,
- b.mActions, false /* showCancelButton */, null /* cancelButtonIntent */,
- true /* decoratedCustomView */);
- NotificationCompatImplBase.buildIntoRemoteViews(b.mContext, n.bigContentView,
- innerView);
- setBackgroundColor(b.mContext, n.bigContentView, b.getColor());
- } else if (b.mStyle instanceof DecoratedCustomViewStyle) {
- addDecoratedBigStyleToBuilderJellybean(n, b);
- }
- }
-
- private static void setBackgroundColor(Context context, RemoteViews views, int color) {
- if (color == COLOR_DEFAULT) {
- color = context.getResources().getColor(
- R.color.notification_material_background_media_default_color);
- }
- views.setInt(R.id.status_bar_latest_event_content, "setBackgroundColor", color);
- }
-
- @RequiresApi(21)
- private static void addHeadsUpToBuilderLollipop(Notification n,
- android.support.v4.app.NotificationCompat.Builder b) {
- RemoteViews innerView = b.getHeadsUpContentView() != null
- ? b.getHeadsUpContentView()
- : b.getContentView();
- if (b.mStyle instanceof DecoratedMediaCustomViewStyle && innerView != null) {
- n.headsUpContentView = NotificationCompatImplBase.generateMediaBigView(b.mContext,
- b.mContentTitle, b.mContentText, b.mContentInfo, b.mNumber,
- b.mLargeIcon, b.mSubText, b.mUseChronometer, b.getWhenIfShowing(),
- b.getPriority(), 0, b.mActions, false /* showCancelButton */,
- null /* cancelButtonIntent */, true /* decoratedCustomView */);
- NotificationCompatImplBase.buildIntoRemoteViews(b.mContext, n.headsUpContentView,
- innerView);
- setBackgroundColor(b.mContext, n.headsUpContentView, b.getColor());
- } else if (b.mStyle instanceof DecoratedCustomViewStyle) {
- addDecoratedHeadsUpToBuilderLollipop(n, b);
- }
- }
-
/**
- * See {@link android.support.v4.app.NotificationCompat}. In addition to the builder in v4, this
- * builder also supports {@link MediaStyle}.
+ * See {@link android.support.v4.app.NotificationCompat}.
*/
public static class Builder extends android.support.v4.app.NotificationCompat.Builder {
@@ -385,140 +83,6 @@
public Builder(Context context) {
super(context);
}
-
- /**
- * @return the text of the notification
- *
- * @hide
- */
- @RestrictTo(LIBRARY_GROUP)
- @Override
- protected CharSequence resolveText() {
- if (mStyle instanceof MessagingStyle) {
- MessagingStyle style = (MessagingStyle) mStyle;
- MessagingStyle.Message m = findLatestIncomingMessage(style);
- CharSequence conversationTitle = style.getConversationTitle();
- if (m != null) {
- return conversationTitle != null ? makeMessageLine(this, style, m)
- : m.getText();
- }
- }
- return super.resolveText();
- }
-
- /**
- * @return the title of the notification
- *
- * @hide
- */
- @RestrictTo(LIBRARY_GROUP)
- @Override
- protected CharSequence resolveTitle() {
- if (mStyle instanceof MessagingStyle) {
- MessagingStyle style = (MessagingStyle) mStyle;
- MessagingStyle.Message m = findLatestIncomingMessage(style);
- CharSequence conversationTitle = style.getConversationTitle();
- if (conversationTitle != null || m != null) {
- return conversationTitle != null ? conversationTitle : m.getSender();
- }
- }
- return super.resolveTitle();
- }
-
- /**
- * @hide
- */
- @RestrictTo(LIBRARY_GROUP)
- @Override
- protected BuilderExtender getExtender() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- return new Api24Extender();
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- return new LollipopExtender();
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- return new JellybeanExtender();
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- return new IceCreamSandwichExtender();
- } else {
- return super.getExtender();
- }
- }
- }
-
- @RequiresApi(14)
- private static class IceCreamSandwichExtender extends BuilderExtender {
-
- IceCreamSandwichExtender() {
- }
-
- @Override
- public Notification build(android.support.v4.app.NotificationCompat.Builder b,
- NotificationBuilderWithBuilderAccessor builder) {
- RemoteViews contentView = addStyleGetContentViewIcs(builder, b);
- Notification n = builder.build();
- // The above call might override decorated content views again, let's make sure it
- // sticks.
- if (contentView != null) {
- n.contentView = contentView;
- } else if (b.getContentView() != null) {
- n.contentView = b.getContentView();
- }
- return n;
- }
- }
-
- @RequiresApi(16)
- private static class JellybeanExtender extends BuilderExtender {
-
- JellybeanExtender() {
- }
-
- @Override
- public Notification build(android.support.v4.app.NotificationCompat.Builder b,
- NotificationBuilderWithBuilderAccessor builder) {
- RemoteViews contentView = addStyleGetContentViewJellybean(builder, b);
- Notification n = builder.build();
- // The above call might override decorated content views again, let's make sure it
- // sticks.
- if (contentView != null) {
- n.contentView = contentView;
- }
- addBigStyleToBuilderJellybean(n, b);
- return n;
- }
- }
-
- @RequiresApi(21)
- private static class LollipopExtender extends BuilderExtender {
-
- LollipopExtender() {
- }
-
- @Override
- public Notification build(android.support.v4.app.NotificationCompat.Builder b,
- NotificationBuilderWithBuilderAccessor builder) {
- RemoteViews contentView = addStyleGetContentViewLollipop(builder, b);
- Notification n = builder.build();
- // The above call might override decorated content views again, let's make sure it
- // sticks.
- if (contentView != null) {
- n.contentView = contentView;
- }
- addBigStyleToBuilderLollipop(n, b);
- addHeadsUpToBuilderLollipop(n, b);
- return n;
- }
- }
-
- @RequiresApi(24)
- private static class Api24Extender extends BuilderExtender {
-
- @Override
- public Notification build(android.support.v4.app.NotificationCompat.Builder b,
- NotificationBuilderWithBuilderAccessor builder) {
- addStyleToBuilderApi24(builder, b);
- return builder.build();
- }
}
/**
@@ -562,6 +126,9 @@
*/
public static class MediaStyle extends android.support.v4.app.NotificationCompat.Style {
+ private static final int MAX_MEDIA_BUTTONS_IN_COMPACT = 3;
+ private static final int MAX_MEDIA_BUTTONS = 5;
+
int[] mActionsToShowInCompact = null;
MediaSessionCompat.Token mToken;
boolean mShowCancelButton;
@@ -619,7 +186,9 @@
* @param show whether to show a cancel button
*/
public MediaStyle setShowCancelButton(boolean show) {
- mShowCancelButton = show;
+ if (Build.VERSION.SDK_INT < 21) {
+ mShowCancelButton = show;
+ }
return this;
}
@@ -633,6 +202,142 @@
mCancelButtonIntent = pendingIntent;
return this;
}
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public void apply(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 21) {
+ builder.getBuilder().setStyle(
+ fillInMediaStyle(new Notification.MediaStyle()));
+ } else if (mShowCancelButton) {
+ builder.getBuilder().setOngoing(true);
+ }
+ }
+
+ @RequiresApi(21)
+ Notification.MediaStyle fillInMediaStyle(Notification.MediaStyle style) {
+ if (mActionsToShowInCompact != null) {
+ style.setShowActionsInCompactView(mActionsToShowInCompact);
+ }
+ if (mToken != null) {
+ style.setMediaSession((MediaSession.Token) mToken.getToken());
+ }
+ return style;
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public RemoteViews makeContentView(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 21) {
+ // No custom content view required
+ return null;
+ }
+ return generateContentView();
+ }
+
+ RemoteViews generateContentView() {
+ RemoteViews view = NotificationCompatImplBase.applyStandardTemplate(
+ mBuilder, false /* showSmallIcon */,
+ getContentViewLayoutResource(), true /* fitIn1U */);
+
+ final int numActions = mBuilder.mActions.size();
+ final int numActionsInCompact = mActionsToShowInCompact == null
+ ? 0
+ : Math.min(mActionsToShowInCompact.length, MAX_MEDIA_BUTTONS_IN_COMPACT);
+ view.removeAllViews(R.id.media_actions);
+ if (numActionsInCompact > 0) {
+ for (int i = 0; i < numActionsInCompact; i++) {
+ if (i >= numActions) {
+ throw new IllegalArgumentException(String.format(
+ "setShowActionsInCompactView: action %d out of bounds (max %d)",
+ i, numActions - 1));
+ }
+
+ final NotificationCompat.Action action =
+ mBuilder.mActions.get(mActionsToShowInCompact[i]);
+ final RemoteViews button = generateMediaActionButton(action);
+ view.addView(R.id.media_actions, button);
+ }
+ }
+ if (mShowCancelButton) {
+ view.setViewVisibility(R.id.end_padder, View.GONE);
+ view.setViewVisibility(R.id.cancel_action, View.VISIBLE);
+ view.setOnClickPendingIntent(R.id.cancel_action, mCancelButtonIntent);
+ view.setInt(R.id.cancel_action, "setAlpha", mBuilder.mContext
+ .getResources().getInteger(R.integer.cancel_button_image_alpha));
+ } else {
+ view.setViewVisibility(R.id.end_padder, View.VISIBLE);
+ view.setViewVisibility(R.id.cancel_action, View.GONE);
+ }
+ return view;
+ }
+
+ private RemoteViews generateMediaActionButton(NotificationCompat.Action action) {
+ final boolean tombstone = (action.getActionIntent() == null);
+ RemoteViews button = new RemoteViews(mBuilder.mContext.getPackageName(),
+ R.layout.notification_media_action);
+ button.setImageViewResource(R.id.action0, action.getIcon());
+ if (!tombstone) {
+ button.setOnClickPendingIntent(R.id.action0, action.getActionIntent());
+ }
+ if (Build.VERSION.SDK_INT >= 15) {
+ button.setContentDescription(R.id.action0, action.getTitle());
+ }
+ return button;
+ }
+
+ int getContentViewLayoutResource() {
+ return R.layout.notification_template_media;
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public RemoteViews makeBigContentView(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 21) {
+ // No custom content view required
+ return null;
+ }
+ return generateBigContentView();
+ }
+
+ RemoteViews generateBigContentView() {
+ final int actionCount = Math.min(mBuilder.mActions.size(), MAX_MEDIA_BUTTONS);
+ RemoteViews big = NotificationCompatImplBase.applyStandardTemplate(
+ mBuilder, false /* showSmallIcon */,
+ getBigContentViewLayoutResource(actionCount), false /* fitIn1U */);
+
+ big.removeAllViews(R.id.media_actions);
+ if (actionCount > 0) {
+ for (int i = 0; i < actionCount; i++) {
+ final RemoteViews button = generateMediaActionButton(mBuilder.mActions.get(i));
+ big.addView(R.id.media_actions, button);
+ }
+ }
+ if (mShowCancelButton) {
+ big.setViewVisibility(R.id.cancel_action, View.VISIBLE);
+ big.setInt(R.id.cancel_action, "setAlpha", mBuilder.mContext
+ .getResources().getInteger(R.integer.cancel_button_image_alpha));
+ big.setOnClickPendingIntent(R.id.cancel_action, mCancelButtonIntent);
+ } else {
+ big.setViewVisibility(R.id.cancel_action, View.GONE);
+ }
+ return big;
+ }
+
+ int getBigContentViewLayoutResource(int actionCount) {
+ return actionCount <= 3
+ ? R.layout.notification_template_big_media_narrow
+ : R.layout.notification_template_big_media;
+ }
}
@@ -666,8 +371,121 @@
*/
public static class DecoratedCustomViewStyle extends Style {
+ private static final int MAX_ACTION_BUTTONS = 3;
+
public DecoratedCustomViewStyle() {
}
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public void apply(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 24) {
+ builder.getBuilder().setStyle(new Notification.DecoratedCustomViewStyle());
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public RemoteViews makeContentView(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 24) {
+ // No custom content view required
+ return null;
+ }
+ if (mBuilder.getContentView() == null) {
+ // No special content view
+ return null;
+ }
+ return createRemoteViews(mBuilder.getContentView(), false);
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public RemoteViews makeBigContentView(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 24) {
+ // No custom big content view required
+ return null;
+ }
+ RemoteViews bigContentView = mBuilder.getBigContentView();
+ RemoteViews innerView = bigContentView != null
+ ? bigContentView
+ : mBuilder.getContentView();
+ if (innerView == null) {
+ // No expandable notification
+ return null;
+ }
+ return createRemoteViews(innerView, true);
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public RemoteViews makeHeadsUpContentView(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 24) {
+ // No custom heads up content view required
+ return null;
+ }
+ RemoteViews headsUp = mBuilder.getHeadsUpContentView();
+ RemoteViews innerView = headsUp != null ? headsUp : mBuilder.getContentView();
+ if (headsUp == null) {
+ // No expandable notification
+ return null;
+ }
+ return createRemoteViews(innerView, true);
+ }
+
+ private RemoteViews createRemoteViews(RemoteViews innerView, boolean showActions) {
+ RemoteViews remoteViews = NotificationCompatImplBase.applyStandardTemplate(
+ mBuilder, true /* showSmallIcon */,
+ R.layout.notification_template_custom_big, false /* fitIn1U */);
+ remoteViews.removeAllViews(R.id.actions);
+ boolean actionsVisible = false;
+ if (showActions && mBuilder.mActions != null) {
+ int numActions = Math.max(mBuilder.mActions.size(), MAX_ACTION_BUTTONS);
+ if (numActions > 0) {
+ actionsVisible = true;
+ for (int i = 0; i < numActions; i++) {
+ final RemoteViews button = generateActionButton(mBuilder.mActions.get(i));
+ remoteViews.addView(R.id.actions, button);
+ }
+ }
+ }
+ int actionVisibility = actionsVisible ? View.VISIBLE : View.GONE;
+ remoteViews.setViewVisibility(R.id.actions, actionVisibility);
+ remoteViews.setViewVisibility(R.id.action_divider, actionVisibility);
+ NotificationCompatImplBase.buildIntoRemoteViews(mBuilder.mContext,
+ remoteViews, innerView);
+ return remoteViews;
+ }
+
+ private RemoteViews generateActionButton(NotificationCompat.Action action) {
+ final boolean tombstone = (action.actionIntent == null);
+ RemoteViews button = new RemoteViews(mBuilder.mContext.getPackageName(),
+ tombstone ? R.layout.notification_action_tombstone
+ : R.layout.notification_action);
+ button.setImageViewBitmap(R.id.action_image,
+ NotificationCompatImplBase.createColoredBitmap(mBuilder.mContext,
+ action.getIcon(), mBuilder.mContext.getResources()
+ .getColor(R.color.notification_action_color_filter)));
+ button.setTextViewText(R.id.action_text, action.title);
+ if (!tombstone) {
+ button.setOnClickPendingIntent(R.id.action_container, action.actionIntent);
+ }
+ if (Build.VERSION.SDK_INT >= 15) {
+ button.setContentDescription(R.id.action_container, action.title);
+ }
+ return button;
+ }
}
/**
@@ -707,5 +525,134 @@
public DecoratedMediaCustomViewStyle() {
}
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public void apply(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 24) {
+ builder.getBuilder().setStyle(
+ fillInMediaStyle(new Notification.DecoratedMediaCustomViewStyle()));
+ } else {
+ super.apply(builder);
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public RemoteViews makeContentView(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 24) {
+ // No custom content view required
+ return null;
+ }
+ boolean hasContentView = mBuilder.getContentView() != null;
+ if (Build.VERSION.SDK_INT >= 21) {
+ // If we are on L/M the media notification will only be colored if the expanded
+ // version is of media style, so we have to create a custom view for the collapsed
+ // version as well in that case.
+ boolean createCustomContent = hasContentView
+ || mBuilder.getBigContentView() != null;
+ if (createCustomContent) {
+ RemoteViews contentView = generateContentView();
+ if (hasContentView) {
+ NotificationCompatImplBase.buildIntoRemoteViews(mBuilder.mContext,
+ contentView,
+ mBuilder.getContentView());
+ }
+ setBackgroundColor(contentView);
+ return contentView;
+ }
+ } else {
+ RemoteViews contentView = generateContentView();
+ if (hasContentView) {
+ NotificationCompatImplBase.buildIntoRemoteViews(mBuilder.mContext,
+ contentView,
+ mBuilder.getContentView());
+ return contentView;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ int getContentViewLayoutResource() {
+ return mBuilder.getContentView() != null
+ ? R.layout.notification_template_media_custom
+ : super.getContentViewLayoutResource();
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public RemoteViews makeBigContentView(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 24) {
+ // No custom big content view required
+ return null;
+ }
+ RemoteViews innerView = mBuilder.getBigContentView() != null
+ ? mBuilder.getBigContentView()
+ : mBuilder.getContentView();
+ if (innerView == null) {
+ // No expandable notification
+ return null;
+ }
+ RemoteViews bigContentView = generateBigContentView();
+ NotificationCompatImplBase.buildIntoRemoteViews(mBuilder.mContext,
+ bigContentView,
+ innerView);
+ if (Build.VERSION.SDK_INT >= 21) {
+ setBackgroundColor(bigContentView);
+ }
+ return bigContentView;
+ }
+
+ @Override
+ int getBigContentViewLayoutResource(int actionCount) {
+ return actionCount <= 3
+ ? R.layout.notification_template_big_media_narrow_custom
+ : R.layout.notification_template_big_media_custom;
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ @Override
+ public RemoteViews makeHeadsUpContentView(NotificationBuilderWithBuilderAccessor builder) {
+ if (Build.VERSION.SDK_INT >= 24) {
+ // No custom heads up content view required
+ return null;
+ }
+ RemoteViews innerView = mBuilder.getHeadsUpContentView() != null
+ ? mBuilder.getHeadsUpContentView()
+ : mBuilder.getContentView();
+ if (innerView == null) {
+ // No expandable notification
+ return null;
+ }
+ RemoteViews headsUpContentView = generateBigContentView();
+ NotificationCompatImplBase.buildIntoRemoteViews(mBuilder.mContext,
+ headsUpContentView,
+ innerView);
+ if (Build.VERSION.SDK_INT >= 21) {
+ setBackgroundColor(headsUpContentView);
+ }
+ return headsUpContentView;
+ }
+
+ private void setBackgroundColor(RemoteViews views) {
+ int color = mBuilder.getColor() != COLOR_DEFAULT
+ ? mBuilder.getColor()
+ : mBuilder.mContext.getResources().getColor(
+ R.color.notification_material_background_media_default_color);
+ views.setInt(R.id.status_bar_latest_event_content, "setBackgroundColor", color);
+ }
}
}
diff --git a/v7/appcompat/src/android/support/v7/app/NotificationCompatImpl21.java b/v7/appcompat/src/android/support/v7/app/NotificationCompatImpl21.java
deleted file mode 100644
index 2a4bf7b..0000000
--- a/v7/appcompat/src/android/support/v7/app/NotificationCompatImpl21.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v7.app;
-
-import android.app.Notification;
-import android.media.session.MediaSession;
-import android.support.annotation.RequiresApi;
-import android.support.v4.app.NotificationBuilderWithBuilderAccessor;
-
-@RequiresApi(21)
-class NotificationCompatImpl21 {
-
- public static void addMediaStyle(NotificationBuilderWithBuilderAccessor b,
- int[] actionsToShowInCompact,
- Object token) {
- Notification.MediaStyle style = new Notification.MediaStyle(b.getBuilder());
- if (actionsToShowInCompact != null) {
- style.setShowActionsInCompactView(actionsToShowInCompact);
- }
- if (token != null) {
- style.setMediaSession((MediaSession.Token) token);
- }
- }
-}
diff --git a/v7/appcompat/src/android/support/v7/app/NotificationCompatImpl24.java b/v7/appcompat/src/android/support/v7/app/NotificationCompatImpl24.java
deleted file mode 100644
index cc09bb5..0000000
--- a/v7/appcompat/src/android/support/v7/app/NotificationCompatImpl24.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.support.v7.app;
-
-import android.app.Notification;
-import android.media.session.MediaSession;
-import android.support.annotation.RequiresApi;
-import android.support.v4.app.NotificationBuilderWithBuilderAccessor;
-
-@RequiresApi(24)
-class NotificationCompatImpl24 {
-
- public static void addDecoratedCustomViewStyle(NotificationBuilderWithBuilderAccessor b) {
- Notification.Builder builder = b.getBuilder();
- builder.setStyle(new Notification.DecoratedCustomViewStyle());
- }
-
- public static void addDecoratedMediaCustomViewStyle(NotificationBuilderWithBuilderAccessor b,
- int[] actionsToShowInCompact,
- Object token) {
- Notification.Builder builder = b.getBuilder();
- Notification.DecoratedMediaCustomViewStyle style =
- new Notification.DecoratedMediaCustomViewStyle();
- if (actionsToShowInCompact != null) {
- style.setShowActionsInCompactView(actionsToShowInCompact);
- }
- if (token != null) {
- style.setMediaSession((MediaSession.Token) token);
- }
- builder.setStyle(style);
- }
-}
diff --git a/v7/appcompat/src/android/support/v7/app/NotificationCompatImplBase.java b/v7/appcompat/src/android/support/v7/app/NotificationCompatImplBase.java
index c1432c9..b2d5eaa 100644
--- a/v7/appcompat/src/android/support/v7/app/NotificationCompatImplBase.java
+++ b/v7/appcompat/src/android/support/v7/app/NotificationCompatImplBase.java
@@ -16,8 +16,6 @@
package android.support.v7.app;
-import android.app.Notification;
-import android.app.PendingIntent;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -29,17 +27,13 @@
import android.os.Build;
import android.os.SystemClock;
import android.support.annotation.RequiresApi;
-import android.support.v4.app.NotificationBuilderWithBuilderAccessor;
import android.support.v4.app.NotificationCompat;
-import android.support.v4.app.NotificationCompatBase;
import android.support.v7.appcompat.R;
import android.util.TypedValue;
import android.view.View;
import android.widget.RemoteViews;
import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.List;
/**
* Helper class to generate MediaStyle notifications for pre-Lollipop platforms. Overrides
@@ -48,196 +42,7 @@
@RequiresApi(9)
class NotificationCompatImplBase {
- static final int MAX_MEDIA_BUTTONS_IN_COMPACT = 3;
- static final int MAX_MEDIA_BUTTONS = 5;
- private static final int MAX_ACTION_BUTTONS = 3;
-
- @RequiresApi(11)
- public static <T extends NotificationCompatBase.Action> RemoteViews overrideContentViewMedia(
- NotificationBuilderWithBuilderAccessor builder,
- Context context, CharSequence contentTitle, CharSequence contentText,
- CharSequence contentInfo, int number, Bitmap largeIcon, CharSequence subText,
- boolean useChronometer, long when, int priority, List<T> actions,
- int[] actionsToShowInCompact, boolean showCancelButton,
- PendingIntent cancelButtonIntent, boolean isDecoratedCustomView) {
- RemoteViews views = generateContentViewMedia(context, contentTitle, contentText, contentInfo,
- number, largeIcon, subText, useChronometer, when, priority, actions,
- actionsToShowInCompact, showCancelButton, cancelButtonIntent,
- isDecoratedCustomView);
- builder.getBuilder().setContent(views);
- if (showCancelButton) {
- builder.getBuilder().setOngoing(true);
- }
- return views;
- }
-
- @RequiresApi(11)
- private static <T extends NotificationCompatBase.Action> RemoteViews generateContentViewMedia(
- Context context, CharSequence contentTitle, CharSequence contentText,
- CharSequence contentInfo, int number, Bitmap largeIcon, CharSequence subText,
- boolean useChronometer, long when, int priority, List<T> actions,
- int[] actionsToShowInCompact, boolean showCancelButton,
- PendingIntent cancelButtonIntent, boolean isDecoratedCustomView) {
- RemoteViews view = applyStandardTemplate(context, contentTitle, contentText, contentInfo,
- number, 0 /* smallIcon */, largeIcon, subText, useChronometer, when, priority,
- 0 /* color is unused on media */,
- isDecoratedCustomView ? R.layout.notification_template_media_custom
- : R.layout.notification_template_media,
- true /* fitIn1U */);
-
- final int numActions = actions.size();
- final int N = actionsToShowInCompact == null
- ? 0
- : Math.min(actionsToShowInCompact.length, MAX_MEDIA_BUTTONS_IN_COMPACT);
- view.removeAllViews(R.id.media_actions);
- if (N > 0) {
- for (int i = 0; i < N; i++) {
- if (i >= numActions) {
- throw new IllegalArgumentException(String.format(
- "setShowActionsInCompactView: action %d out of bounds (max %d)",
- i, numActions - 1));
- }
-
- final NotificationCompatBase.Action action = actions.get(actionsToShowInCompact[i]);
- final RemoteViews button = generateMediaActionButton(context, action);
- view.addView(R.id.media_actions, button);
- }
- }
- if (showCancelButton) {
- view.setViewVisibility(R.id.end_padder, View.GONE);
- view.setViewVisibility(R.id.cancel_action, View.VISIBLE);
- view.setOnClickPendingIntent(R.id.cancel_action, cancelButtonIntent);
- view.setInt(R.id.cancel_action, "setAlpha",
- context.getResources().getInteger(R.integer.cancel_button_image_alpha));
- } else {
- view.setViewVisibility(R.id.end_padder, View.VISIBLE);
- view.setViewVisibility(R.id.cancel_action, View.GONE);
- }
- return view;
- }
-
- @RequiresApi(16)
- public static <T extends NotificationCompatBase.Action> void overrideMediaBigContentView(
- Notification n, Context context, CharSequence contentTitle, CharSequence contentText,
- CharSequence contentInfo, int number, Bitmap largeIcon, CharSequence subText,
- boolean useChronometer, long when, int priority, int color, List<T> actions,
- boolean showCancelButton, PendingIntent cancelButtonIntent,
- boolean decoratedCustomView) {
- n.bigContentView = generateMediaBigView(context, contentTitle, contentText, contentInfo,
- number, largeIcon, subText, useChronometer, when, priority, color, actions,
- showCancelButton, cancelButtonIntent, decoratedCustomView);
- if (showCancelButton) {
- n.flags |= Notification.FLAG_ONGOING_EVENT;
- }
- }
-
- @RequiresApi(11)
- public static <T extends NotificationCompatBase.Action> RemoteViews generateMediaBigView(
- Context context, CharSequence contentTitle, CharSequence contentText,
- CharSequence contentInfo, int number, Bitmap largeIcon, CharSequence subText,
- boolean useChronometer, long when, int priority, int color, List<T> actions,
- boolean showCancelButton, PendingIntent cancelButtonIntent,
- boolean decoratedCustomView) {
- final int actionCount = Math.min(actions.size(), MAX_MEDIA_BUTTONS);
- RemoteViews big = applyStandardTemplate(context, contentTitle, contentText, contentInfo,
- number, 0 /* smallIcon */, largeIcon, subText, useChronometer, when, priority,
- color, /* fitIn1U */getBigMediaLayoutResource(decoratedCustomView, actionCount),
- false);
-
- big.removeAllViews(R.id.media_actions);
- if (actionCount > 0) {
- for (int i = 0; i < actionCount; i++) {
- final RemoteViews button = generateMediaActionButton(context, actions.get(i));
- big.addView(R.id.media_actions, button);
- }
- }
- if (showCancelButton) {
- big.setViewVisibility(R.id.cancel_action, View.VISIBLE);
- big.setInt(R.id.cancel_action, "setAlpha",
- context.getResources().getInteger(R.integer.cancel_button_image_alpha));
- big.setOnClickPendingIntent(R.id.cancel_action, cancelButtonIntent);
- } else {
- big.setViewVisibility(R.id.cancel_action, View.GONE);
- }
- return big;
- }
-
- @RequiresApi(11)
- private static RemoteViews generateMediaActionButton(Context context,
- NotificationCompatBase.Action action) {
- final boolean tombstone = (action.getActionIntent() == null);
- RemoteViews button = new RemoteViews(context.getPackageName(),
- R.layout.notification_media_action);
- button.setImageViewResource(R.id.action0, action.getIcon());
- if (!tombstone) {
- button.setOnClickPendingIntent(R.id.action0, action.getActionIntent());
- }
- if (Build.VERSION.SDK_INT >= 15) {
- button.setContentDescription(R.id.action0, action.getTitle());
- }
- return button;
- }
-
- @RequiresApi(11)
- private static int getBigMediaLayoutResource(boolean decoratedCustomView, int actionCount) {
- if (actionCount <= 3) {
- return decoratedCustomView
- ? R.layout.notification_template_big_media_narrow_custom
- : R.layout.notification_template_big_media_narrow;
- } else {
- return decoratedCustomView
- ? R.layout.notification_template_big_media_custom
- : R.layout.notification_template_big_media;
- }
- }
-
- public static RemoteViews applyStandardTemplateWithActions(Context context,
- CharSequence contentTitle, CharSequence contentText, CharSequence contentInfo,
- int number, int smallIcon, Bitmap largeIcon, CharSequence subText,
- boolean useChronometer, long when, int priority, int color, int resId, boolean fitIn1U,
- ArrayList<NotificationCompat.Action> actions) {
- RemoteViews remoteViews = applyStandardTemplate(context, contentTitle, contentText,
- contentInfo, number, smallIcon, largeIcon, subText, useChronometer, when, priority,
- color, resId, fitIn1U);
- remoteViews.removeAllViews(R.id.actions);
- boolean actionsVisible = false;
- if (actions != null) {
- int N = actions.size();
- if (N > 0) {
- actionsVisible = true;
- if (N > MAX_ACTION_BUTTONS) N = MAX_ACTION_BUTTONS;
- for (int i = 0; i < N; i++) {
- final RemoteViews button = generateActionButton(context, actions.get(i));
- remoteViews.addView(R.id.actions, button);
- }
- }
- }
- int actionVisibility = actionsVisible ? View.VISIBLE : View.GONE;
- remoteViews.setViewVisibility(R.id.actions, actionVisibility);
- remoteViews.setViewVisibility(R.id.action_divider, actionVisibility);
- return remoteViews;
- }
-
- private static RemoteViews generateActionButton(Context context,
- NotificationCompat.Action action) {
- final boolean tombstone = (action.actionIntent == null);
- RemoteViews button = new RemoteViews(context.getPackageName(),
- tombstone ? getActionTombstoneLayoutResource()
- : getActionLayoutResource());
- button.setImageViewBitmap(R.id.action_image,
- createColoredBitmap(context, action.getIcon(),
- context.getResources().getColor(R.color.notification_action_color_filter)));
- button.setTextViewText(R.id.action_text, action.title);
- if (!tombstone) {
- button.setOnClickPendingIntent(R.id.action_container, action.actionIntent);
- }
- if (Build.VERSION.SDK_INT >= 15) {
- button.setContentDescription(R.id.action_container, action.title);
- }
- return button;
- }
-
- private static Bitmap createColoredBitmap(Context context, int iconId, int color) {
+ static Bitmap createColoredBitmap(Context context, int iconId, int color) {
return createColoredBitmap(context, iconId, color, 0);
}
@@ -256,25 +61,14 @@
return resultBitmap;
}
- private static int getActionLayoutResource() {
- return R.layout.notification_action;
- }
-
- private static int getActionTombstoneLayoutResource() {
- return R.layout.notification_action_tombstone;
- }
-
- public static RemoteViews applyStandardTemplate(Context context,
- CharSequence contentTitle, CharSequence contentText, CharSequence contentInfo,
- int number, int smallIcon, Bitmap largeIcon, CharSequence subText,
- boolean useChronometer, long when, int priority, int color, int resId,
- boolean fitIn1U) {
- Resources res = context.getResources();
- RemoteViews contentView = new RemoteViews(context.getPackageName(), resId);
+ public static RemoteViews applyStandardTemplate(NotificationCompat.Builder builder,
+ boolean showSmallIcon, int resId, boolean fitIn1U) {
+ Resources res = builder.mContext.getResources();
+ RemoteViews contentView = new RemoteViews(builder.mContext.getPackageName(), resId);
boolean showLine3 = false;
boolean showLine2 = false;
- boolean minPriority = priority < NotificationCompat.PRIORITY_LOW;
+ boolean minPriority = builder.getPriority() < NotificationCompat.PRIORITY_LOW;
if (Build.VERSION.SDK_INT >= 16 && Build.VERSION.SDK_INT < 21) {
// lets color the backgrounds
if (minPriority) {
@@ -290,34 +84,34 @@
}
}
- if (largeIcon != null) {
+ if (builder.mLargeIcon != null) {
// On versions before Jellybean, the large icon was shown by SystemUI, so we need to hide
// it here.
if (Build.VERSION.SDK_INT >= 16) {
contentView.setViewVisibility(R.id.icon, View.VISIBLE);
- contentView.setImageViewBitmap(R.id.icon, largeIcon);
+ contentView.setImageViewBitmap(R.id.icon, builder.mLargeIcon);
} else {
contentView.setViewVisibility(R.id.icon, View.GONE);
}
- if (smallIcon != 0) {
+ if (showSmallIcon && builder.mNotification.icon != 0) {
int backgroundSize = res.getDimensionPixelSize(
R.dimen.notification_right_icon_size);
int iconSize = backgroundSize - res.getDimensionPixelSize(
R.dimen.notification_small_icon_background_padding) * 2;
if (Build.VERSION.SDK_INT >= 21) {
- Bitmap smallBit = createIconWithBackground(context,
- smallIcon,
+ Bitmap smallBit = createIconWithBackground(builder.mContext,
+ builder.mNotification.icon,
backgroundSize,
iconSize,
- color);
+ builder.getColor());
contentView.setImageViewBitmap(R.id.right_icon, smallBit);
} else {
- contentView.setImageViewBitmap(R.id.right_icon,
- createColoredBitmap(context, smallIcon, Color.WHITE));
+ contentView.setImageViewBitmap(R.id.right_icon, createColoredBitmap(
+ builder.mContext, builder.mNotification.icon, Color.WHITE));
}
contentView.setViewVisibility(R.id.right_icon, View.VISIBLE);
}
- } else if (smallIcon != 0) { // small icon at left
+ } else if (showSmallIcon && builder.mNotification.icon != 0) { // small icon at left
contentView.setViewVisibility(R.id.icon, View.VISIBLE);
if (Build.VERSION.SDK_INT >= 21) {
int backgroundSize = res.getDimensionPixelSize(
@@ -325,40 +119,40 @@
- res.getDimensionPixelSize(R.dimen.notification_big_circle_margin);
int iconSize = res.getDimensionPixelSize(
R.dimen.notification_small_icon_size_as_large);
- Bitmap smallBit = createIconWithBackground(context,
- smallIcon,
+ Bitmap smallBit = createIconWithBackground(builder.mContext,
+ builder.mNotification.icon,
backgroundSize,
iconSize,
- color);
+ builder.getColor());
contentView.setImageViewBitmap(R.id.icon, smallBit);
} else {
- contentView.setImageViewBitmap(R.id.icon,
- createColoredBitmap(context, smallIcon, Color.WHITE));
+ contentView.setImageViewBitmap(R.id.icon, createColoredBitmap(
+ builder.mContext, builder.mNotification.icon, Color.WHITE));
}
}
- if (contentTitle != null) {
- contentView.setTextViewText(R.id.title, contentTitle);
+ if (builder.mContentTitle != null) {
+ contentView.setTextViewText(R.id.title, builder.mContentTitle);
}
- if (contentText != null) {
- contentView.setTextViewText(R.id.text, contentText);
+ if (builder.mContentText != null) {
+ contentView.setTextViewText(R.id.text, builder.mContentText);
showLine3 = true;
}
// If there is a large icon we have a right side
- boolean hasRightSide = !(Build.VERSION.SDK_INT >= 21) && largeIcon != null;
- if (contentInfo != null) {
- contentView.setTextViewText(R.id.info, contentInfo);
+ boolean hasRightSide = !(Build.VERSION.SDK_INT >= 21) && builder.mLargeIcon != null;
+ if (builder.mContentInfo != null) {
+ contentView.setTextViewText(R.id.info, builder.mContentInfo);
contentView.setViewVisibility(R.id.info, View.VISIBLE);
showLine3 = true;
hasRightSide = true;
- } else if (number > 0) {
+ } else if (builder.mNumber > 0) {
final int tooBig = res.getInteger(
R.integer.status_bar_notification_info_maxnum);
- if (number > tooBig) {
+ if (builder.mNumber > tooBig) {
contentView.setTextViewText(R.id.info, ((Resources) res).getString(
R.string.status_bar_notification_info_overflow));
} else {
NumberFormat f = NumberFormat.getIntegerInstance();
- contentView.setTextViewText(R.id.info, f.format(number));
+ contentView.setTextViewText(R.id.info, f.format(builder.mNumber));
}
contentView.setViewVisibility(R.id.info, View.VISIBLE);
showLine3 = true;
@@ -368,10 +162,10 @@
}
// Need to show three lines? Only allow on Jellybean+
- if (subText != null && Build.VERSION.SDK_INT >= 16) {
- contentView.setTextViewText(R.id.text, subText);
- if (contentText != null) {
- contentView.setTextViewText(R.id.text2, contentText);
+ if (builder.mSubText != null && Build.VERSION.SDK_INT >= 16) {
+ contentView.setTextViewText(R.id.text, builder.mSubText);
+ if (builder.mContentText != null) {
+ contentView.setTextViewText(R.id.text2, builder.mContentText);
contentView.setViewVisibility(R.id.text2, View.VISIBLE);
showLine2 = true;
} else {
@@ -391,15 +185,16 @@
contentView.setViewPadding(R.id.line1, 0, 0, 0, 0);
}
- if (when != 0) {
- if (useChronometer && Build.VERSION.SDK_INT >= 16) {
+ if (builder.getWhenIfShowing() != 0) {
+ if (builder.mUseChronometer && Build.VERSION.SDK_INT >= 16) {
contentView.setViewVisibility(R.id.chronometer, View.VISIBLE);
contentView.setLong(R.id.chronometer, "setBase",
- when + (SystemClock.elapsedRealtime() - System.currentTimeMillis()));
+ builder.getWhenIfShowing()
+ + (SystemClock.elapsedRealtime() - System.currentTimeMillis()));
contentView.setBoolean(R.id.chronometer, "setStarted", true);
} else {
contentView.setViewVisibility(R.id.time, View.VISIBLE);
- contentView.setLong(R.id.time, "setTime", when);
+ contentView.setLong(R.id.time, "setTime", builder.getWhenIfShowing());
}
hasRightSide = true;
}
diff --git a/v7/appcompat/src/android/support/v7/app/NotificationCompatImplJellybean.java b/v7/appcompat/src/android/support/v7/app/NotificationCompatImplJellybean.java
deleted file mode 100644
index 2fca0f0..0000000
--- a/v7/appcompat/src/android/support/v7/app/NotificationCompatImplJellybean.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.support.v7.app;
-
-import android.app.Notification;
-import android.support.annotation.RequiresApi;
-import android.support.v4.app.NotificationBuilderWithBuilderAccessor;
-
-@RequiresApi(16)
-class NotificationCompatImplJellybean {
-
- public static void addBigTextStyle(NotificationBuilderWithBuilderAccessor b,
- CharSequence bigText) {
- Notification.BigTextStyle bigTextStyle = new Notification.BigTextStyle(b.getBuilder());
- bigTextStyle.bigText(bigText);
- }
-}
diff --git a/v7/appcompat/tests/src/android/support/v7/widget/ListPopupWindowTest.java b/v7/appcompat/tests/src/android/support/v7/widget/ListPopupWindowTest.java
index 7ef6a85..2681d0f 100644
--- a/v7/appcompat/tests/src/android/support/v7/widget/ListPopupWindowTest.java
+++ b/v7/appcompat/tests/src/android/support/v7/widget/ListPopupWindowTest.java
@@ -182,9 +182,14 @@
Builder popupBuilder = new Builder().setModal(setupAsModal).withDismissListener();
popupBuilder.wireToActionButton();
+ final View.OnClickListener mockContainerClickListener = mock(View.OnClickListener.class);
// Also register a click listener on the top-level container
- View.OnClickListener mockContainerClickListener = mock(View.OnClickListener.class);
- mContainer.setOnClickListener(mockContainerClickListener);
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mContainer.setOnClickListener(mockContainerClickListener);
+ }
+ });
onView(withId(R.id.test_button)).perform(click());
assertTrue("Popup window showing", mListPopupWindow.isShowing());
diff --git a/v7/gridlayout/lint-baseline.xml b/v7/gridlayout/lint-baseline.xml
index 1c675b0..493c8c5 100644
--- a/v7/gridlayout/lint-baseline.xml
+++ b/v7/gridlayout/lint-baseline.xml
@@ -2,102 +2,14 @@
<issues format="4" by="lint 2.4.0-alpha6">
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
</issues>
diff --git a/v7/mediarouter/build.gradle b/v7/mediarouter/build.gradle
index 093c6c5..f971a0b 100644
--- a/v7/mediarouter/build.gradle
+++ b/v7/mediarouter/build.gradle
@@ -11,7 +11,7 @@
androidTestCompile (libs.espresso_core) {
exclude module: 'support-annotations'
}
- androidTestCompile libs.mockito_core
+ androidTestCompile libs.test_rules
}
android {
diff --git a/v7/mediarouter/lint-baseline.xml b/v7/mediarouter/lint-baseline.xml
index edf2faf..fe44849 100644
--- a/v7/mediarouter/lint-baseline.xml
+++ b/v7/mediarouter/lint-baseline.xml
@@ -105,17 +105,6 @@
</issue>
<issue
- id="ResourceType"
- message="Expected resource of type xml"
- errorLine1=" final XmlPullParser parser = res.getXml(resId);"
- errorLine2=" ~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="557"
- column="53"/>
- </issue>
-
- <issue
id="Range"
message="Value must be ≥ 0 (was -2147483648)"
errorLine1=" MeasureSpec.makeMeasureSpec(largestChildHeight,"
@@ -138,72 +127,6 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="LongLogTag"
message="The logging tag can be at most 23 characters, was 30 (ActionBarDrawerToggleHoneycomb)"
errorLine1=" Log.w(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", e);"
@@ -304,39 +227,6 @@
<issue
id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
message="The logging tag can be at most 23 characters, was 24 (MediaRouteActionProvider)"
errorLine1=" Log.e(TAG, "onCreateActionView: this ActionProvider is already associated " +"
errorLine2=" ~~~">
@@ -347,39 +237,6 @@
</issue>
<issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="AppCompatCustomView"
message="This custom view should extend `android.support.v7.widget.AppCompatAutoCompleteTextView` instead"
errorLine1="public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements"
@@ -568,35 +425,13 @@
<issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
<issue
@@ -621,15 +456,4 @@
column="36"/>
</issue>
- <issue
- id="WrongConstant"
- message="Must be one of: View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL"
- errorLine1=" return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="821"
- column="64"/>
- </issue>
-
</issues>
diff --git a/v7/palette/lint-baseline.xml b/v7/palette/lint-baseline.xml
index d75d39e..172bbf6 100644
--- a/v7/palette/lint-baseline.xml
+++ b/v7/palette/lint-baseline.xml
@@ -1,37 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="4" by="lint 2.4.0-alpha6">
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
</issues>
diff --git a/v7/preference/lint-baseline.xml b/v7/preference/lint-baseline.xml
index c9f4dab..eee7674 100644
--- a/v7/preference/lint-baseline.xml
+++ b/v7/preference/lint-baseline.xml
@@ -94,17 +94,6 @@
</issue>
<issue
- id="ResourceType"
- message="Expected resource of type xml"
- errorLine1=" final XmlPullParser parser = res.getXml(resId);"
- errorLine2=" ~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="557"
- column="53"/>
- </issue>
-
- <issue
id="Range"
message="Value must be ≥ 0 (was -2147483648)"
errorLine1=" MeasureSpec.makeMeasureSpec(largestChildHeight,"
@@ -127,72 +116,6 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
id="Suspicious0dp"
message="Suspicious size: this will make the view invisible, should be used with `layout_weight`"
errorLine1=" android:layout_width="0dp""
@@ -314,171 +237,6 @@
</issue>
<issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="110"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="135"
- column="26"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 25 (FragmentStatePagerAdapter)"
- errorLine1=" Log.w(TAG, "Bad fragment at key " + key);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/app/FragmentStatePagerAdapter.java"
- line="224"
- column="31"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + filepath);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="80"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 28 (RoundedBitmapDrawableFactory)"
- errorLine1=" Log.w(TAG, "RoundedBitmapDrawable cannot decode " + is);"
- errorLine2=" ~~~">
- <location
- file="java/android/support/v4/graphics/drawable/RoundedBitmapDrawableFactory.java"
- line="93"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "found saved state: " + mPendingSavedState);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="783"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Deciding anchor info from fresh state");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="828"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "invalid saved state class");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1187"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "saved state:\n" + state);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1236"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "FILLING targetLine: " + targetLine + ",""
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1559"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "assigned " + currentSpan.mIndex + " for " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1580"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "using " + spanIndex + " for pos " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1584"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "asked " + dt + " scrolled" + totalScroll);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2153"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Unknown focus request:" + focusDirection);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2385"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 24 (WakefulBroadcastReceiver)"
- errorLine1=" Log.w("WakefulBroadcastReceiver", "No active wake lock id #" + id);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/content/WakefulBroadcastReceiver.java"
- line="141"
- column="19"/>
- </issue>
-
- <issue
id="AppCompatCustomView"
message="This custom view should extend `android.support.v7.widget.AppCompatAutoCompleteTextView` instead"
errorLine1="public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements"
@@ -655,21 +413,6 @@
</issue>
<issue
- id="UniqueConstants"
- message="Constants `FLAG_CVE_EQ_PVE` and `FLAG_CVE_EQ_PVE` specify the same exact value (8192); this is usually a cut & paste or merge error"
- errorLine1=" FLAG_CVE_EQ_PVE, FLAG_CVE_EQ_PVE, FLAG_CVE_LT_PVE"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="30"/>
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="13"/>
- </issue>
-
- <issue
id="WrongConstant"
message="Must be one of: PixelFormat.UNKNOWN, PixelFormat.TRANSLUCENT, PixelFormat.TRANSPARENT, PixelFormat.OPAQUE"
errorLine1=" return 0;"
@@ -682,35 +425,13 @@
<issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
<issue
@@ -735,15 +456,4 @@
column="36"/>
</issue>
- <issue
- id="WrongConstant"
- message="Must be one of: View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL"
- errorLine1=" return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/graphics/drawable/VectorDrawableCompat.java"
- line="821"
- column="64"/>
- </issue>
-
</issues>
diff --git a/v7/recyclerview/lint-baseline.xml b/v7/recyclerview/lint-baseline.xml
index 443b10a..493c8c5 100644
--- a/v7/recyclerview/lint-baseline.xml
+++ b/v7/recyclerview/lint-baseline.xml
@@ -2,216 +2,14 @@
<issues format="4" by="lint 2.4.0-alpha6">
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "found saved state: " + mPendingSavedState);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="783"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Deciding anchor info from fresh state");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="828"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "invalid saved state class");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1187"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "saved state:\n" + state);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1236"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "FILLING targetLine: " + targetLine + ",""
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1559"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "assigned " + currentSpan.mIndex + " for " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1580"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "using " + spanIndex + " for pos " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1584"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "asked " + dt + " scrolled" + totalScroll);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2153"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Unknown focus request:" + focusDirection);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2385"
- column="27"/>
- </issue>
-
- <issue
- id="UniqueConstants"
- message="Constants `FLAG_CVE_EQ_PVE` and `FLAG_CVE_EQ_PVE` specify the same exact value (8192); this is usually a cut & paste or merge error"
- errorLine1=" FLAG_CVE_EQ_PVE, FLAG_CVE_EQ_PVE, FLAG_CVE_LT_PVE"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="30"/>
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="13"/>
- </issue>
-
- <issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
</issues>
diff --git a/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java b/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
index a72975d..a229846 100644
--- a/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
+++ b/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
@@ -491,6 +491,7 @@
// resolve layout direction
resolveShouldLayoutReverse();
+ final View focused = getFocusedChild();
if (!mAnchorInfo.mValid || mPendingScrollPosition != NO_POSITION
|| mPendingSavedState != null) {
mAnchorInfo.reset();
@@ -498,6 +499,22 @@
// calculate anchor position and coordinate
updateAnchorInfoForLayout(recycler, state, mAnchorInfo);
mAnchorInfo.mValid = true;
+ } else if (focused != null && (mOrientationHelper.getDecoratedStart(focused)
+ >= mOrientationHelper.getEndAfterPadding()
+ || mOrientationHelper.getDecoratedEnd(focused)
+ <= mOrientationHelper.getStartAfterPadding())) {
+ // This case relates to when the anchor child is the focused view and due to layout
+ // shrinking the focused view fell outside the viewport, e.g. when soft keyboard shows
+ // up after tapping an EditText which shrinks RV causing the focused view (The tapped
+ // EditText which is the anchor child) to get kicked out of the screen. Will update the
+ // anchor coordinate in order to make sure that the focused view is laid out. Otherwise,
+ // the available space in layoutState will be calculated as negative preventing the
+ // focused view from being laid out in fill.
+ // Note that we won't update the anchor position between layout passes (refer to
+ // TestResizingRelayoutWithAutoMeasure), which happens if we were to call
+ // updateAnchorInfoForLayout for an anchor that's not the focused view (e.g. a reference
+ // child which can change between layout passes).
+ mAnchorInfo.assignFromViewAndKeepVisibleRect(focused);
}
if (DEBUG) {
Log.d(TAG, "Anchor info:" + mAnchorInfo);
diff --git a/v7/recyclerview/src/android/support/v7/widget/SnapHelper.java b/v7/recyclerview/src/android/support/v7/widget/SnapHelper.java
index d63045b..d85a27a 100644
--- a/v7/recyclerview/src/android/support/v7/widget/SnapHelper.java
+++ b/v7/recyclerview/src/android/support/v7/widget/SnapHelper.java
@@ -19,6 +19,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView.LayoutManager;
+import android.support.v7.widget.RecyclerView.SmoothScroller;
import android.support.v7.widget.RecyclerView.SmoothScroller.ScrollVectorProvider;
import android.util.DisplayMetrics;
import android.view.View;
@@ -159,7 +160,7 @@
return false;
}
- RecyclerView.SmoothScroller smoothScroller = createSnapScroller(layoutManager);
+ SmoothScroller smoothScroller = createScroller(layoutManager);
if (smoothScroller == null) {
return false;
}
@@ -203,9 +204,24 @@
* @param layoutManager The {@link RecyclerView.LayoutManager} associated with the attached
* {@link RecyclerView}.
*
- * @return a {@link LinearSmoothScroller} which will handle the scrolling.
+ * @return a {@link SmoothScroller} which will handle the scrolling.
*/
@Nullable
+ protected SmoothScroller createScroller(LayoutManager layoutManager) {
+ return createSnapScroller(layoutManager);
+ }
+
+ /**
+ * Creates a scroller to be used in the snapping implementation.
+ *
+ * @param layoutManager The {@link RecyclerView.LayoutManager} associated with the attached
+ * {@link RecyclerView}.
+ *
+ * @return a {@link LinearSmoothScroller} which will handle the scrolling.
+ * @deprecated use {@link #createScroller(LayoutManager)} instead.
+ */
+ @Nullable
+ @Deprecated
protected LinearSmoothScroller createSnapScroller(LayoutManager layoutManager) {
if (!(layoutManager instanceof ScrollVectorProvider)) {
return null;
@@ -281,4 +297,4 @@
*/
public abstract int findTargetSnapPosition(LayoutManager layoutManager, int velocityX,
int velocityY);
-}
\ No newline at end of file
+}
diff --git a/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java b/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
index 679f483..f3ea045 100644
--- a/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
+++ b/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
@@ -55,7 +55,7 @@
public class StaggeredGridLayoutManager extends RecyclerView.LayoutManager implements
RecyclerView.SmoothScroller.ScrollVectorProvider {
- private static final String TAG = "StaggeredGridLayoutManager";
+ private static final String TAG = "StaggeredGridLManager";
static final boolean DEBUG = false;
diff --git a/v7/recyclerview/src/android/support/v7/widget/ViewBoundsCheck.java b/v7/recyclerview/src/android/support/v7/widget/ViewBoundsCheck.java
index 8a4f89c..191a069 100644
--- a/v7/recyclerview/src/android/support/v7/widget/ViewBoundsCheck.java
+++ b/v7/recyclerview/src/android/support/v7/widget/ViewBoundsCheck.java
@@ -122,7 +122,7 @@
FLAG_CVS_GT_PVS, FLAG_CVS_EQ_PVS, FLAG_CVS_LT_PVS,
FLAG_CVS_GT_PVE, FLAG_CVS_EQ_PVE, FLAG_CVS_LT_PVE,
FLAG_CVE_GT_PVS, FLAG_CVE_EQ_PVS, FLAG_CVE_LT_PVS,
- FLAG_CVE_EQ_PVE, FLAG_CVE_EQ_PVE, FLAG_CVE_LT_PVE
+ FLAG_CVE_GT_PVE, FLAG_CVE_EQ_PVE, FLAG_CVE_LT_PVE
})
@Retention(RetentionPolicy.SOURCE)
public @interface ViewBounds {}
diff --git a/v7/recyclerview/tests/src/android/support/v7/util/ImeCleanUpTestRule.java b/v7/recyclerview/tests/src/android/support/v7/util/ImeCleanUpTestRule.java
new file mode 100644
index 0000000..f4caad3
--- /dev/null
+++ b/v7/recyclerview/tests/src/android/support/v7/util/ImeCleanUpTestRule.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2017 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.support.v7.util;
+
+import android.graphics.Rect;
+import android.support.testutils.PollingCheck;
+import android.view.View;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * A JUnit rule that ensures that IME is closed after a test is finished (or exception thrown).
+ * A test that triggers IME open/close should call setContainerView with the activity's container
+ * view in order to trigger this cleanup at the end of the test. Otherwise, no cleanup happens.
+ */
+public class ImeCleanUpTestRule implements TestRule {
+
+ private View mContainerView;
+
+ @Override
+ public Statement apply(final Statement base, Description description) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ try {
+ base.evaluate();
+ } finally {
+ closeImeIfOpen();
+ }
+ }
+ };
+ }
+
+ /**
+ * Sets the container view used to calculate the total screen height and the height available
+ * to the test activity.
+ */
+ public void setContainerView(View containerView) {
+ mContainerView = containerView;
+ }
+
+ private void closeImeIfOpen() {
+ if (mContainerView == null) {
+ return;
+ }
+ // Ensuring that IME is closed after starting each test.
+ final Rect r = new Rect();
+ mContainerView.getWindowVisibleDisplayFrame(r);
+ // This is the entire height of the screen available to both the view and IME
+ final int screenHeight = mContainerView.getRootView().getHeight();
+
+ // r.bottom is the position above IME if it's open or device button.
+ // if IME is shown, r.bottom is smaller than screenHeight.
+ int imeHeight = screenHeight - r.bottom;
+
+ // Picking a threshold to detect when IME is open
+ if (imeHeight > screenHeight * 0.15) {
+ // Soft keyboard is shown, will wait for it to close after running the test. Note that
+ // we don't press back button here as the IME should close by itself when a test
+ // finishes. If the wait isn't done here, the IME can mess up with the layout of the
+ // next test.
+ PollingCheck.waitFor(new PollingCheck.PollingCheckCondition() {
+ @Override
+ public boolean canProceed() {
+ mContainerView.getWindowVisibleDisplayFrame(r);
+ int imeHeight = screenHeight - r.bottom;
+ return imeHeight < screenHeight * 0.15;
+ }
+ });
+ }
+ }
+}
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/BaseGridLayoutManagerTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/BaseGridLayoutManagerTest.java
index cc6bbe8..13dd1e4 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/BaseGridLayoutManagerTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/BaseGridLayoutManagerTest.java
@@ -325,6 +325,36 @@
}
}
+ class GridEditTextAdapter extends EditTextAdapter {
+
+ Set<Integer> mFullSpanItems = new HashSet<Integer>();
+ int mSpanPerItem = 1;
+
+ GridEditTextAdapter(int count) {
+ this(count, 1);
+ }
+
+ GridEditTextAdapter(int count, int spanPerItem) {
+ super(count);
+ mSpanPerItem = spanPerItem;
+ }
+
+ void setFullSpan(int... items) {
+ for (int i : items) {
+ mFullSpanItems.add(i);
+ }
+ }
+
+ void assignSpanSizeLookup(final GridLayoutManager glm) {
+ glm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ return mFullSpanItems.contains(position) ? glm.getSpanCount() : mSpanPerItem;
+ }
+ });
+ }
+ }
+
class GridTestAdapter extends TestAdapter {
Set<Integer> mFullSpanItems = new HashSet<Integer>();
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
index 8ca5f4e..90e0536 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
@@ -38,10 +38,12 @@
import android.support.v4.view.ViewCompat;
import android.support.v7.recyclerview.test.R;
import android.support.v7.recyclerview.test.SameActivityTestRule;
+import android.text.Editable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.TextView;
@@ -793,6 +795,37 @@
}
}
+ public class EditTextAdapter extends RecyclerView.Adapter<TestViewHolder> {
+
+ final ArrayList<Editable> mEditables;
+ public EditTextAdapter(int count) {
+ mEditables = new ArrayList<>();
+ for (int i = 0; i < count; ++i) {
+ mEditables.add(Editable.Factory.getInstance().newEditable("Sample Text " + i));
+ }
+ }
+
+ @Override
+ public TestViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ final EditText editText = new EditText(parent.getContext());
+ editText.setLayoutParams(new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
+ final TestViewHolder viewHolder = new TestViewHolder(editText);
+ return viewHolder;
+ }
+
+ @Override
+ public void onBindViewHolder(TestViewHolder holder, int position) {
+ ((EditText) holder.itemView).setText(Editable.Factory.getInstance().newEditable(
+ mEditables.get(position)));
+ }
+
+ @Override
+ public int getItemCount() {
+ return mEditables.size();
+ }
+ }
+
public class TestAdapter extends RecyclerView.Adapter<TestViewHolder>
implements AttachDetachCountingAdapter {
@@ -1197,6 +1230,27 @@
}
}
+
+ public static View findFirstFullyVisibleChild(RecyclerView parent) {
+ for (int i = 0; i < parent.getChildCount(); i++) {
+ View child = parent.getChildAt(i);
+ if (isViewFullyInBound(parent, child)) {
+ return child;
+ }
+ }
+ return null;
+ }
+
+ public static View findLastFullyVisibleChild(RecyclerView parent) {
+ for (int i = parent.getChildCount() - 1; i >= 0; i--) {
+ View child = parent.getChildAt(i);
+ if (isViewFullyInBound(parent, child)) {
+ return child;
+ }
+ }
+ return null;
+ }
+
/**
* Returns whether a child of RecyclerView is partially in bound. A child is
* partially in-bounds if it's either fully or partially visible on the screen.
@@ -1232,7 +1286,7 @@
* @param child The child view to be checked whether is fully within RV's bounds.
* @return True if the child view is fully visible; false otherwise.
*/
- public boolean isViewFullyInBound(RecyclerView parent, View child) {
+ public static boolean isViewFullyInBound(RecyclerView parent, View child) {
if (child == null) {
return false;
}
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/GridLayoutManagerTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/GridLayoutManagerTest.java
index 5ebebfe..23eaf52 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/GridLayoutManagerTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/GridLayoutManagerTest.java
@@ -18,6 +18,9 @@
import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
import static android.support.v7.widget.LinearLayoutManager.VERTICAL;
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
+import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
@@ -34,15 +37,20 @@
import android.support.test.filters.LargeTest;
import android.support.test.filters.SdkSuppress;
import android.support.test.runner.AndroidJUnit4;
+import android.support.testutils.PollingCheck;
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
+import android.support.v7.util.ImeCleanUpTestRule;
+import android.support.v7.util.TouchUtils;
import android.test.UiThreadTest;
import android.util.SparseIntArray;
import android.util.StateSet;
+import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import org.hamcrest.CoreMatchers;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -56,6 +64,9 @@
@RunWith(AndroidJUnit4.class)
public class GridLayoutManagerTest extends BaseGridLayoutManagerTest {
+ @Rule
+ public final ImeCleanUpTestRule imeCleanUp = new ImeCleanUpTestRule();
+
@Test
public void focusSearchFailureUp() throws Throwable {
focusSearchFailure(false);
@@ -168,6 +179,101 @@
}
}
+ @Test
+ public void editTextVisibility() throws Throwable {
+ final int spanCount = 3;
+ final int itemCount = 100;
+
+ imeCleanUp.setContainerView(getActivity().getContainer());
+ RecyclerView recyclerView = new WrappedRecyclerView(getActivity());
+ GridEditTextAdapter editTextAdapter = new GridEditTextAdapter(itemCount) {
+ @Override
+ public TestViewHolder onCreateViewHolder(ViewGroup parent,
+ int viewType) {
+ TestViewHolder testViewHolder = super.onCreateViewHolder(parent, viewType);
+ // Good to have colors for debugging
+ StateListDrawable stl = new StateListDrawable();
+ stl.addState(new int[]{android.R.attr.state_focused},
+ new ColorDrawable(Color.RED));
+ stl.addState(StateSet.WILD_CARD, new ColorDrawable(Color.BLUE));
+ //noinspection deprecation using this for kitkat tests
+ testViewHolder.itemView.setBackgroundDrawable(stl);
+ return testViewHolder;
+ }
+ };
+ mActivityRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mActivityRule.getActivity().getWindow().setSoftInputMode(SOFT_INPUT_ADJUST_RESIZE);
+ }
+ });
+
+ recyclerView.setLayoutParams(
+ new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
+
+ Config config = new Config(spanCount, itemCount);
+ mGlm = new WrappedGridLayoutManager(getActivity(), config.mSpanCount, config.mOrientation,
+ config.mReverseLayout);
+ editTextAdapter.assignSpanSizeLookup(mGlm);
+ recyclerView.setAdapter(editTextAdapter);
+ recyclerView.setLayoutManager(mGlm);
+ waitForFirstLayout(recyclerView);
+
+ // First focus on the last fully visible EditText located at span index #1.
+ View toFocus = findLastFullyVisibleChild(mRecyclerView);
+ int focusIndex = mRecyclerView.getChildAdapterPosition(toFocus);
+ focusIndex = (focusIndex / spanCount) * spanCount + 1;
+ toFocus = mRecyclerView.findViewHolderForAdapterPosition(focusIndex).itemView;
+ assertTrue(focusIndex >= 1 && focusIndex < itemCount);
+
+ final int heightBeforeImeOpen = mRecyclerView.getHeight();
+ TouchUtils.tapView(getInstrumentation(), mRecyclerView, toFocus);
+ getInstrumentation().waitForIdleSync();
+ // Wait for IME to pop up.
+ PollingCheck.waitFor(new PollingCheck.PollingCheckCondition() {
+ @Override
+ public boolean canProceed() {
+ return mRecyclerView.getHeight() < heightBeforeImeOpen;
+ }
+ });
+
+ assertThat("Child at position " + focusIndex + " should be focused",
+ toFocus.hasFocus(), is(true));
+ assertTrue("Child view at adapter pos " + focusIndex + " should be fully visible.",
+ isViewPartiallyInBound(mRecyclerView, toFocus));
+
+ // Close IME
+ final int heightBeforeImeClose = mRecyclerView.getHeight();
+ getInstrumentation().sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
+ getInstrumentation().waitForIdleSync();
+ // Wait for IME to close
+ PollingCheck.waitFor(new PollingCheck.PollingCheckCondition() {
+ @Override
+ public boolean canProceed() {
+ return mRecyclerView.getHeight() > heightBeforeImeClose;
+ }
+ });
+ assertTrue("Child view at adapter pos " + focusIndex + " should be fully visible.",
+ isViewPartiallyInBound(mRecyclerView, toFocus));
+
+ // Now focus on the first fully visible EditText located at the last span index.
+ toFocus = findFirstFullyVisibleChild(mRecyclerView);
+ focusIndex = mRecyclerView.getChildAdapterPosition(toFocus);
+ focusIndex = (focusIndex / spanCount) * spanCount + (spanCount - 1);
+ toFocus = mRecyclerView.findViewHolderForAdapterPosition(focusIndex).itemView;
+ final int heightBeforeImeOpen2 = mRecyclerView.getHeight();
+ TouchUtils.tapView(getInstrumentation(), mRecyclerView, toFocus);
+ getInstrumentation().waitForIdleSync();
+ // Wait for IME to pop up
+ PollingCheck.waitFor(new PollingCheck.PollingCheckCondition() {
+ @Override
+ public boolean canProceed() {
+ return mRecyclerView.getHeight() < heightBeforeImeOpen2;
+ }
+ });
+ assertTrue("Child view at adapter pos " + focusIndex + " should be fully visible.",
+ isViewPartiallyInBound(mRecyclerView, toFocus));
+ }
@Test
public void topUnfocusableViewsVisibility() throws Throwable {
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java
index a2db640..91d0dbf 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java
@@ -18,6 +18,9 @@
import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
import static android.support.v7.widget.LinearLayoutManager.VERTICAL;
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
+import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
@@ -34,13 +37,19 @@
import android.os.Build;
import android.support.test.filters.LargeTest;
import android.support.test.filters.SdkSuppress;
+import android.support.testutils.PollingCheck;
import android.support.v4.view.AccessibilityDelegateCompat;
+import android.support.v7.util.ImeCleanUpTestRule;
+import android.support.v7.util.TouchUtils;
import android.util.Log;
import android.util.StateSet;
+import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
+import android.widget.LinearLayout;
+import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
@@ -60,6 +69,111 @@
@LargeTest
public class LinearLayoutManagerTest extends BaseLinearLayoutManagerTest {
+ @Rule
+ public final ImeCleanUpTestRule imeCleanUp = new ImeCleanUpTestRule();
+
+ @Test
+ public void editTextVisibility() throws Throwable {
+
+ // Simulating a scenario where an EditText is tapped (which will receive focus).
+ // The soft keyboard that's opened overlaps the focused EditText which will shrink RV's
+ // padded bounded area. LLM should still lay out the focused EditText so that it becomes
+ // visible above the soft keyboard.
+ // The condition for this test is setting RV's height to a non-exact height, so that measure
+ // is called twice (once with the larger height and another time with smaller height when
+ // the keyboard shows up). To ensure this resizing of RV, SOFT_INPUT_ADJUST_RESIZE is set.
+ imeCleanUp.setContainerView(getActivity().getContainer());
+ final LinearLayout container = new LinearLayout(getActivity());
+ container.setOrientation(LinearLayout.VERTICAL);
+ container.setLayoutParams(
+ new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup
+ .LayoutParams.MATCH_PARENT));
+
+ final EditTextAdapter editTextAdapter = new EditTextAdapter(50);
+
+ mRecyclerView = inflateWrappedRV();
+ ViewGroup.LayoutParams lp = mRecyclerView.getLayoutParams();
+ lp.height = WRAP_CONTENT;
+ lp.width = MATCH_PARENT;
+
+ mRecyclerView.setHasFixedSize(true);
+ mRecyclerView.setAdapter(editTextAdapter);
+ mLayoutManager = new WrappedLinearLayoutManager(getActivity(), VERTICAL, false);
+ mRecyclerView.setLayoutManager(mLayoutManager);
+
+ container.addView(mRecyclerView);
+
+ mLayoutManager.expectLayouts(1);
+ mActivityRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ getActivity().getContainer().addView(container);
+ }
+ });
+ mActivityRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mActivityRule.getActivity().getWindow().setSoftInputMode(SOFT_INPUT_ADJUST_RESIZE);
+ }
+ });
+
+ // First focus on the last fully visible EditText.
+ View toFocus = findLastFullyVisibleChild(mRecyclerView);
+ int focusIndex = mRecyclerView.getChildAdapterPosition(toFocus);
+
+ final int heightBeforeImeOpen = mRecyclerView.getHeight();
+ TouchUtils.tapView(getInstrumentation(), mRecyclerView, toFocus);
+ getInstrumentation().waitForIdleSync();
+ // Wait for IME to pop up.
+ PollingCheck.waitFor(new PollingCheck.PollingCheckCondition() {
+ @Override
+ public boolean canProceed() {
+ return mRecyclerView.getHeight() < heightBeforeImeOpen;
+ }
+ });
+
+ assertThat("Child at position " + focusIndex + " should be focused",
+ toFocus.hasFocus(), is(true));
+ // Testing for partial visibility instead of full visibility since TextView calls
+ // requestRectangleOnScreen (inside bringPointIntoView) for the focused view with a rect
+ // containing the content area. This rect is guaranteed to be fully visible whereas a
+ // portion of TextView could be out of bounds.
+ assertTrue("Child view at adapter pos " + focusIndex + " should be fully visible.",
+ isViewPartiallyInBound(mRecyclerView, toFocus));
+
+ // Close IME
+ final int heightBeforeImeClose = mRecyclerView.getHeight();
+ getInstrumentation().sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
+ getInstrumentation().waitForIdleSync();
+ // Wait for IME to close
+ PollingCheck.waitFor(new PollingCheck.PollingCheckCondition() {
+ @Override
+ public boolean canProceed() {
+ return mRecyclerView.getHeight() > heightBeforeImeClose;
+ }
+ });
+ assertThat("Child at position " + focusIndex + " should be focused",
+ toFocus.hasFocus(), is(true));
+ assertTrue("Child view at adapter pos " + focusIndex + " should be fully visible.",
+ isViewPartiallyInBound(mRecyclerView, toFocus));
+
+ // Now focus on the first fully visible EditText.
+ toFocus = findFirstFullyVisibleChild(mRecyclerView);
+ focusIndex = mRecyclerView.getChildAdapterPosition(toFocus);
+ final int heightBeforeImeOpen2 = mRecyclerView.getHeight();
+ TouchUtils.tapView(getInstrumentation(), mRecyclerView, toFocus);
+ getInstrumentation().waitForIdleSync();
+ // Wait for IME to pop up
+ PollingCheck.waitFor(new PollingCheck.PollingCheckCondition() {
+ @Override
+ public boolean canProceed() {
+ return mRecyclerView.getHeight() < heightBeforeImeOpen2;
+ }
+ });
+ assertTrue("Child view at adapter pos " + focusIndex + " should be fully visible.",
+ isViewPartiallyInBound(mRecyclerView, toFocus));
+ }
+
@Test
public void topUnfocusableViewsVisibility() throws Throwable {
// The maximum number of child views that can be visible at any time.
diff --git a/wear/lint-baseline.xml b/wear/lint-baseline.xml
index ba39be4..962399c 100644
--- a/wear/lint-baseline.xml
+++ b/wear/lint-baseline.xml
@@ -28,216 +28,14 @@
</issue>
<issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="536"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="538"
- column="63"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="586"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="589"
- column="79"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="608"
- column="75"/>
- </issue>
-
- <issue
- id="Range"
- message="Value must be ≥ 0 (was -1)"
- errorLine1=" childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/SlidingPaneLayout.java"
- line="611"
- column="75"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "found saved state: " + mPendingSavedState);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="783"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Deciding anchor info from fresh state");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="828"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "invalid saved state class");"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1187"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "saved state:\n" + state);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1236"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "FILLING targetLine: " + targetLine + ",""
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1559"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "assigned " + currentSpan.mIndex + " for " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1580"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "using " + spanIndex + " for pos " + position);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="1584"
- column="27"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "asked " + dt + " scrolled" + totalScroll);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2153"
- column="19"/>
- </issue>
-
- <issue
- id="LongLogTag"
- message="The logging tag can be at most 23 characters, was 26 (StaggeredGridLayoutManager)"
- errorLine1=" Log.d(TAG, "Unknown focus request:" + focusDirection);"
- errorLine2=" ~~~">
- <location
- file="src/android/support/v7/widget/StaggeredGridLayoutManager.java"
- line="2385"
- column="27"/>
- </issue>
-
- <issue
- id="UniqueConstants"
- message="Constants `FLAG_CVE_EQ_PVE` and `FLAG_CVE_EQ_PVE` specify the same exact value (8192); this is usually a cut & paste or merge error"
- errorLine1=" FLAG_CVE_EQ_PVE, FLAG_CVE_EQ_PVE, FLAG_CVE_LT_PVE"
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="30"/>
- <location
- file="src/android/support/v7/widget/ViewBoundsCheck.java"
- line="125"
- column="13"/>
- </issue>
-
- <issue
id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" setDrawerLockMode(lockMode, gravity);"
- errorLine2=" ~~~~~~~">
+ message="Must be one or more of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
+ errorLine1=" + gravityToString(childGravity) + " but this " + TAG + " already has a ""
+ errorLine2=" ~~~~~~~~~~~~">
<location
file="java/android/support/v4/widget/DrawerLayout.java"
- line="680"
- column="37"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one of: Gravity.LEFT, Gravity.RIGHT, GravityCompat.START, GravityCompat.END"
- errorLine1=" return getDrawerLockMode(drawerGravity);"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="753"
- column="34"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Flag not allowed here"
- errorLine1=" getDrawerViewAbsoluteGravity(child) & Gravity.HORIZONTAL_GRAVITY_MASK;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="java/android/support/v4/widget/DrawerLayout.java"
- line="1086"
- column="25"/>
+ line="1075"
+ column="47"/>
</issue>
</issues>