Merge "Use @Suppress to remove lint-baseline" into androidx-main
diff --git a/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityMenuTest.kt b/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityMenuTest.kt
index 1a5bf0e..bcff2a4 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityMenuTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityMenuTest.kt
@@ -46,7 +46,8 @@
import org.junit.Test
import org.junit.runner.RunWith
-@SdkSuppress(minSdkVersion = Build.VERSION_CODES.JELLY_BEAN_MR2) // b/229013665
+@SdkSuppress(minSdkVersion = Build.VERSION_CODES.O) // Previous SDK levels have issues passing
+// null menu that causes leak canary to crash to we don't want to run on those devices
@MediumTest
@RunWith(AndroidJUnit4::class)
class ComponentActivityMenuTest {
diff --git a/arch/core/core-common/api/restricted_current.txt b/arch/core/core-common/api/restricted_current.txt
index b565cc8..7f1c354 100644
--- a/arch/core/core-common/api/restricted_current.txt
+++ b/arch/core/core-common/api/restricted_current.txt
@@ -3,18 +3,18 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class FastSafeIterableMap<K, V> extends androidx.arch.core.internal.SafeIterableMap<K,V> {
ctor public FastSafeIterableMap();
- method public java.util.Map.Entry<K!,V!>! ceil(K!);
+ method public java.util.Map.Entry<K!,V!>? ceil(K!);
method public boolean contains(K!);
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class SafeIterableMap<K, V> implements java.lang.Iterable<java.util.Map.Entry<K,V>> {
ctor public SafeIterableMap();
- method public java.util.Iterator<java.util.Map.Entry<K!,V!>!>! descendingIterator();
- method public java.util.Map.Entry<K!,V!>! eldest();
- method protected androidx.arch.core.internal.SafeIterableMap.Entry<K!,V!>! get(K!);
+ method public java.util.Iterator<java.util.Map.Entry<K!,V!>!> descendingIterator();
+ method public java.util.Map.Entry<K!,V!>? eldest();
+ method protected androidx.arch.core.internal.SafeIterableMap.Entry<K!,V!>? get(K!);
method public java.util.Iterator<java.util.Map.Entry<K!,V!>!> iterator();
- method public androidx.arch.core.internal.SafeIterableMap.IteratorWithAdditions! iteratorWithAdditions();
- method public java.util.Map.Entry<K!,V!>! newest();
+ method public androidx.arch.core.internal.SafeIterableMap.IteratorWithAdditions iteratorWithAdditions();
+ method public java.util.Map.Entry<K!,V!>? newest();
method public V! putIfAbsent(K, V);
method public V! remove(K);
method public int size();
diff --git a/arch/core/core-common/src/main/java/androidx/arch/core/internal/FastSafeIterableMap.java b/arch/core/core-common/src/main/java/androidx/arch/core/internal/FastSafeIterableMap.java
index 9437fee2..a0ba47e 100644
--- a/arch/core/core-common/src/main/java/androidx/arch/core/internal/FastSafeIterableMap.java
+++ b/arch/core/core-common/src/main/java/androidx/arch/core/internal/FastSafeIterableMap.java
@@ -17,6 +17,7 @@
package androidx.arch.core.internal;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import java.util.HashMap;
@@ -34,8 +35,9 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
public class FastSafeIterableMap<K, V> extends SafeIterableMap<K, V> {
- private HashMap<K, Entry<K, V>> mHashMap = new HashMap<>();
+ private final HashMap<K, Entry<K, V>> mHashMap = new HashMap<>();
+ @Nullable
@SuppressWarnings("HiddenTypeParameter")
@Override
protected Entry<K, V> get(K k) {
@@ -72,6 +74,7 @@
*
* @param k the key
*/
+ @Nullable
public Map.Entry<K, V> ceil(K k) {
if (contains(k)) {
return mHashMap.get(k).mPrevious;
diff --git a/arch/core/core-common/src/main/java/androidx/arch/core/internal/SafeIterableMap.java b/arch/core/core-common/src/main/java/androidx/arch/core/internal/SafeIterableMap.java
index bfa031a..08cce2f 100644
--- a/arch/core/core-common/src/main/java/androidx/arch/core/internal/SafeIterableMap.java
+++ b/arch/core/core-common/src/main/java/androidx/arch/core/internal/SafeIterableMap.java
@@ -17,6 +17,7 @@
package androidx.arch.core.internal;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import java.util.Iterator;
@@ -39,9 +40,10 @@
private Entry<K, V> mEnd;
// using WeakHashMap over List<WeakReference>, so we don't have to manually remove
// WeakReferences that have null in them.
- private WeakHashMap<SupportRemove<K, V>, Boolean> mIterators = new WeakHashMap<>();
+ private final WeakHashMap<SupportRemove<K, V>, Boolean> mIterators = new WeakHashMap<>();
private int mSize = 0;
+ @Nullable
@SuppressWarnings("HiddenTypeParameter")
protected Entry<K, V> get(K k) {
Entry<K, V> currentNode = mStart;
@@ -147,6 +149,7 @@
* @return an descending iterator, which doesn't include new elements added during an
* iteration.
*/
+ @NonNull
public Iterator<Map.Entry<K, V>> descendingIterator() {
DescendingIterator<K, V> iterator = new DescendingIterator<>(mEnd, mStart);
mIterators.put(iterator, false);
@@ -156,8 +159,8 @@
/**
* return an iterator with additions.
*/
+ @NonNull
public IteratorWithAdditions iteratorWithAdditions() {
- @SuppressWarnings("unchecked")
IteratorWithAdditions iterator = new IteratorWithAdditions();
mIterators.put(iterator, false);
return iterator;
@@ -166,6 +169,7 @@
/**
* @return eldest added entry or null
*/
+ @Nullable
public Map.Entry<K, V> eldest() {
return mStart;
}
@@ -173,10 +177,12 @@
/**
* @return newest added entry or null
*/
+ @Nullable
public Map.Entry<K, V> newest() {
return mEnd;
}
+ @SuppressWarnings("rawtypes")
@Override
public boolean equals(Object obj) {
if (obj == this) {
@@ -205,9 +211,8 @@
@Override
public int hashCode() {
int h = 0;
- Iterator<Map.Entry<K, V>> i = iterator();
- while (i.hasNext()) {
- h += i.next().hashCode();
+ for (Map.Entry<K, V> kvEntry : this) {
+ h += kvEntry.hashCode();
}
return h;
}
@@ -392,7 +397,7 @@
return mKey + "=" + mValue;
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"ReferenceEquality", "rawtypes"})
@Override
public boolean equals(Object obj) {
if (obj == this) {
diff --git a/arch/core/core-runtime/api/restricted_current.txt b/arch/core/core-runtime/api/restricted_current.txt
index 263f32f..9958884 100644
--- a/arch/core/core-runtime/api/restricted_current.txt
+++ b/arch/core/core-runtime/api/restricted_current.txt
@@ -2,20 +2,20 @@
package androidx.arch.core.executor {
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ArchTaskExecutor extends androidx.arch.core.executor.TaskExecutor {
- method public void executeOnDiskIO(Runnable!);
+ method public void executeOnDiskIO(Runnable);
method public static java.util.concurrent.Executor getIOThreadExecutor();
method public static androidx.arch.core.executor.ArchTaskExecutor getInstance();
method public static java.util.concurrent.Executor getMainThreadExecutor();
method public boolean isMainThread();
- method public void postToMainThread(Runnable!);
+ method public void postToMainThread(Runnable);
method public void setDelegate(androidx.arch.core.executor.TaskExecutor?);
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class DefaultTaskExecutor extends androidx.arch.core.executor.TaskExecutor {
ctor public DefaultTaskExecutor();
- method public void executeOnDiskIO(Runnable!);
+ method public void executeOnDiskIO(Runnable);
method public boolean isMainThread();
- method public void postToMainThread(Runnable!);
+ method public void postToMainThread(Runnable);
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public abstract class TaskExecutor {
diff --git a/arch/core/core-runtime/src/main/java/androidx/arch/core/executor/ArchTaskExecutor.java b/arch/core/core-runtime/src/main/java/androidx/arch/core/executor/ArchTaskExecutor.java
index cdeb07f..3c31069 100644
--- a/arch/core/core-runtime/src/main/java/androidx/arch/core/executor/ArchTaskExecutor.java
+++ b/arch/core/core-runtime/src/main/java/androidx/arch/core/executor/ArchTaskExecutor.java
@@ -36,23 +36,15 @@
private TaskExecutor mDelegate;
@NonNull
- private TaskExecutor mDefaultTaskExecutor;
+ private final TaskExecutor mDefaultTaskExecutor;
@NonNull
- private static final Executor sMainThreadExecutor = new Executor() {
- @Override
- public void execute(Runnable command) {
- getInstance().postToMainThread(command);
- }
- };
+ private static final Executor sMainThreadExecutor =
+ command -> getInstance().postToMainThread(command);
@NonNull
- private static final Executor sIOThreadExecutor = new Executor() {
- @Override
- public void execute(Runnable command) {
- getInstance().executeOnDiskIO(command);
- }
- };
+ private static final Executor sIOThreadExecutor =
+ command -> getInstance().executeOnDiskIO(command);
private ArchTaskExecutor() {
mDefaultTaskExecutor = new DefaultTaskExecutor();
@@ -92,12 +84,12 @@
}
@Override
- public void executeOnDiskIO(Runnable runnable) {
+ public void executeOnDiskIO(@NonNull Runnable runnable) {
mDelegate.executeOnDiskIO(runnable);
}
@Override
- public void postToMainThread(Runnable runnable) {
+ public void postToMainThread(@NonNull Runnable runnable) {
mDelegate.postToMainThread(runnable);
}
diff --git a/arch/core/core-runtime/src/main/java/androidx/arch/core/executor/DefaultTaskExecutor.java b/arch/core/core-runtime/src/main/java/androidx/arch/core/executor/DefaultTaskExecutor.java
index fa98b29..1bc2123 100644
--- a/arch/core/core-runtime/src/main/java/androidx/arch/core/executor/DefaultTaskExecutor.java
+++ b/arch/core/core-runtime/src/main/java/androidx/arch/core/executor/DefaultTaskExecutor.java
@@ -56,12 +56,12 @@
private volatile Handler mMainHandler;
@Override
- public void executeOnDiskIO(Runnable runnable) {
+ public void executeOnDiskIO(@NonNull Runnable runnable) {
mDiskIO.execute(runnable);
}
@Override
- public void postToMainThread(Runnable runnable) {
+ public void postToMainThread(@NonNull Runnable runnable) {
if (mMainHandler == null) {
synchronized (mLock) {
if (mMainHandler == null) {
diff --git a/arch/core/core-testing/api/current.txt b/arch/core/core-testing/api/current.txt
index 68bf70f..0303b8a 100644
--- a/arch/core/core-testing/api/current.txt
+++ b/arch/core/core-testing/api/current.txt
@@ -3,7 +3,7 @@
public class CountingTaskExecutorRule extends org.junit.rules.TestWatcher {
ctor public CountingTaskExecutorRule();
- method public void drainTasks(int, java.util.concurrent.TimeUnit!) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException;
+ method public void drainTasks(int, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException;
method public boolean isIdle();
method protected void onIdle();
}
diff --git a/arch/core/core-testing/api/public_plus_experimental_current.txt b/arch/core/core-testing/api/public_plus_experimental_current.txt
index 68bf70f..0303b8a 100644
--- a/arch/core/core-testing/api/public_plus_experimental_current.txt
+++ b/arch/core/core-testing/api/public_plus_experimental_current.txt
@@ -3,7 +3,7 @@
public class CountingTaskExecutorRule extends org.junit.rules.TestWatcher {
ctor public CountingTaskExecutorRule();
- method public void drainTasks(int, java.util.concurrent.TimeUnit!) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException;
+ method public void drainTasks(int, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException;
method public boolean isIdle();
method protected void onIdle();
}
diff --git a/arch/core/core-testing/api/restricted_current.txt b/arch/core/core-testing/api/restricted_current.txt
index f537e3f..8113a1d 100644
--- a/arch/core/core-testing/api/restricted_current.txt
+++ b/arch/core/core-testing/api/restricted_current.txt
@@ -3,17 +3,17 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class JunitTaskExecutorRule implements org.junit.rules.TestRule {
ctor public JunitTaskExecutorRule(int, boolean);
- method public org.junit.runners.model.Statement! apply(org.junit.runners.model.Statement!, org.junit.runner.Description!);
+ method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement, org.junit.runner.Description);
method public void drainTasks(int) throws java.lang.InterruptedException;
- method public androidx.arch.core.executor.TaskExecutor! getTaskExecutor();
+ method public androidx.arch.core.executor.TaskExecutor getTaskExecutor();
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class TaskExecutorWithFakeMainThread extends androidx.arch.core.executor.TaskExecutor {
ctor public TaskExecutorWithFakeMainThread(int);
method public void drainTasks(int) throws java.lang.InterruptedException;
- method public void executeOnDiskIO(Runnable!);
+ method public void executeOnDiskIO(Runnable);
method public boolean isMainThread();
- method public void postToMainThread(Runnable!);
+ method public void postToMainThread(Runnable);
}
}
@@ -22,7 +22,7 @@
public class CountingTaskExecutorRule extends org.junit.rules.TestWatcher {
ctor public CountingTaskExecutorRule();
- method public void drainTasks(int, java.util.concurrent.TimeUnit!) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException;
+ method public void drainTasks(int, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException;
method public boolean isIdle();
method protected void onIdle();
}
diff --git a/arch/core/core-testing/src/main/java/androidx/arch/core/executor/JunitTaskExecutorRule.java b/arch/core/core-testing/src/main/java/androidx/arch/core/executor/JunitTaskExecutorRule.java
index 94ebb2b..cf145c2 100644
--- a/arch/core/core-testing/src/main/java/androidx/arch/core/executor/JunitTaskExecutorRule.java
+++ b/arch/core/core-testing/src/main/java/androidx/arch/core/executor/JunitTaskExecutorRule.java
@@ -16,6 +16,7 @@
package androidx.arch.core.executor;
+import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import org.junit.rules.TestRule;
@@ -32,6 +33,7 @@
*
* @hide
*/
+@SuppressWarnings("unused")
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
public class JunitTaskExecutorRule implements TestRule {
private final TaskExecutorWithFakeMainThread mTaskExecutor;
@@ -55,6 +57,7 @@
ArchTaskExecutor.getInstance().setDelegate(null);
}
+ @NonNull
public TaskExecutor getTaskExecutor() {
return mTaskExecutor;
}
@@ -68,11 +71,12 @@
mTaskExecutor.drainTasks(seconds);
}
+ @NonNull
@Override
- public Statement apply(final Statement base, Description description) {
+ public Statement apply(final @NonNull Statement base, @NonNull Description description) {
return new Statement() {
@Override
- public void evaluate() throws Throwable {
+ public void evaluate() {
beforeStart();
try {
base.evaluate();
diff --git a/arch/core/core-testing/src/main/java/androidx/arch/core/executor/TaskExecutorWithFakeMainThread.java b/arch/core/core-testing/src/main/java/androidx/arch/core/executor/TaskExecutorWithFakeMainThread.java
index 89e969b..c9db5e6 100644
--- a/arch/core/core-testing/src/main/java/androidx/arch/core/executor/TaskExecutorWithFakeMainThread.java
+++ b/arch/core/core-testing/src/main/java/androidx/arch/core/executor/TaskExecutorWithFakeMainThread.java
@@ -27,7 +27,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
@@ -40,41 +39,32 @@
@SuppressLint("SyntheticAccessor")
public class TaskExecutorWithFakeMainThread extends TaskExecutor {
@SuppressWarnings("WeakerAccess") /* synthetic access */
- List<Throwable> mCaughtExceptions = Collections.synchronizedList(new ArrayList
- <Throwable>());
+ List<Throwable> mCaughtExceptions = Collections.synchronizedList(new ArrayList<>());
- private ExecutorService mIOService;
+ private final ExecutorService mIOService;
@SuppressWarnings("WeakerAccess") /* synthetic access */
- private AtomicReference<Thread> mMainThread = new AtomicReference<>();
+ private final AtomicReference<Thread> mMainThread = new AtomicReference<>();
private final int mIOThreadCount;
- private ExecutorService mMainThreadService =
- Executors.newSingleThreadExecutor(new ThreadFactory() {
- @Override
- public Thread newThread(@NonNull final Runnable r) {
- mMainThread.compareAndSet(null, new LoggingThread(r));
- return mMainThread.get();
- }
+ private final ExecutorService mMainThreadService =
+ Executors.newSingleThreadExecutor(r -> {
+ mMainThread.compareAndSet(null, new LoggingThread(r));
+ return mMainThread.get();
});
public TaskExecutorWithFakeMainThread(int ioThreadCount) {
mIOThreadCount = ioThreadCount;
- mIOService = Executors.newFixedThreadPool(ioThreadCount, new ThreadFactory() {
- @Override
- public Thread newThread(@NonNull Runnable r) {
- return new LoggingThread(r);
- }
- });
+ mIOService = Executors.newFixedThreadPool(ioThreadCount, LoggingThread::new);
}
@Override
- public void executeOnDiskIO(Runnable runnable) {
+ public void executeOnDiskIO(@NonNull Runnable runnable) {
mIOService.execute(runnable);
}
@Override
- public void postToMainThread(Runnable runnable) {
+ public void postToMainThread(@NonNull Runnable runnable) {
// Tasks in SingleThreadExecutor are guaranteed to execute sequentially,
// and no more than one task will be active at any given time.
// So if we call this method from the main thread, new task will be scheduled,
@@ -91,7 +81,7 @@
return mCaughtExceptions;
}
- @SuppressWarnings("SameParameterValue")
+ @SuppressWarnings({"SameParameterValue", "ResultOfMethodCallIgnored"})
void shutdown(int timeoutInSeconds) throws InterruptedException {
mMainThreadService.shutdown();
mIOService.shutdown();
@@ -102,7 +92,6 @@
/**
* Drains tasks at the given time limit
* @param seconds Number of seconds to wait
- * @throws InterruptedException
*/
public void drainTasks(int seconds) throws InterruptedException {
if (isMainThread()) {
@@ -111,26 +100,18 @@
final CountDownLatch enterLatch = new CountDownLatch(mIOThreadCount);
final CountDownLatch exitLatch = new CountDownLatch(1);
for (int i = 0; i < mIOThreadCount; i++) {
- executeOnDiskIO(new Runnable() {
- @Override
- public void run() {
- enterLatch.countDown();
- try {
- exitLatch.await();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
+ executeOnDiskIO(() -> {
+ enterLatch.countDown();
+ try {
+ exitLatch.await();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
}
});
}
final CountDownLatch mainLatch = new CountDownLatch(1);
- postToMainThread(new Runnable() {
- @Override
- public void run() {
- mainLatch.countDown();
- }
- });
+ postToMainThread(mainLatch::countDown);
if (!enterLatch.await(seconds, TimeUnit.SECONDS)) {
throw new AssertionError("Could not drain IO tasks in " + seconds
+ " seconds");
@@ -145,14 +126,11 @@
@SuppressWarnings("WeakerAccess")
class LoggingThread extends Thread {
LoggingThread(final Runnable target) {
- super(new Runnable() {
- @Override
- public void run() {
- try {
- target.run();
- } catch (Throwable t) {
- mCaughtExceptions.add(t);
- }
+ super(() -> {
+ try {
+ target.run();
+ } catch (Throwable t) {
+ mCaughtExceptions.add(t);
}
});
}
diff --git a/arch/core/core-testing/src/main/java/androidx/arch/core/executor/testing/CountingTaskExecutorRule.java b/arch/core/core-testing/src/main/java/androidx/arch/core/executor/testing/CountingTaskExecutorRule.java
index c41e369..79bd552 100644
--- a/arch/core/core-testing/src/main/java/androidx/arch/core/executor/testing/CountingTaskExecutorRule.java
+++ b/arch/core/core-testing/src/main/java/androidx/arch/core/executor/testing/CountingTaskExecutorRule.java
@@ -18,6 +18,7 @@
import android.os.SystemClock;
+import androidx.annotation.NonNull;
import androidx.arch.core.executor.ArchTaskExecutor;
import androidx.arch.core.executor.DefaultTaskExecutor;
@@ -42,12 +43,12 @@
super.starting(description);
ArchTaskExecutor.getInstance().setDelegate(new DefaultTaskExecutor() {
@Override
- public void executeOnDiskIO(Runnable runnable) {
+ public void executeOnDiskIO(@NonNull Runnable runnable) {
super.executeOnDiskIO(new CountingRunnable(runnable));
}
@Override
- public void postToMainThread(Runnable runnable) {
+ public void postToMainThread(@NonNull Runnable runnable) {
super.postToMainThread(new CountingRunnable(runnable));
}
});
@@ -108,7 +109,7 @@
* @throws InterruptedException If thread is interrupted while waiting
* @throws TimeoutException If tasks cannot be drained at the given time
*/
- public void drainTasks(int time, TimeUnit timeUnit)
+ public void drainTasks(int time, @NonNull TimeUnit timeUnit)
throws InterruptedException, TimeoutException {
long end = SystemClock.uptimeMillis() + timeUnit.toMillis(time);
synchronized (mCountLock) {
diff --git a/arch/core/core-testing/src/main/java/androidx/arch/core/executor/testing/InstantTaskExecutorRule.java b/arch/core/core-testing/src/main/java/androidx/arch/core/executor/testing/InstantTaskExecutorRule.java
index 8c5d0b5..312cb05 100644
--- a/arch/core/core-testing/src/main/java/androidx/arch/core/executor/testing/InstantTaskExecutorRule.java
+++ b/arch/core/core-testing/src/main/java/androidx/arch/core/executor/testing/InstantTaskExecutorRule.java
@@ -16,6 +16,7 @@
package androidx.arch.core.executor.testing;
+import androidx.annotation.NonNull;
import androidx.arch.core.executor.ArchTaskExecutor;
import androidx.arch.core.executor.TaskExecutor;
@@ -34,12 +35,12 @@
super.starting(description);
ArchTaskExecutor.getInstance().setDelegate(new TaskExecutor() {
@Override
- public void executeOnDiskIO(Runnable runnable) {
+ public void executeOnDiskIO(@NonNull Runnable runnable) {
runnable.run();
}
@Override
- public void postToMainThread(Runnable runnable) {
+ public void postToMainThread(@NonNull Runnable runnable) {
runnable.run();
}
diff --git a/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXPluginTest.kt b/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXPluginTest.kt
new file mode 100644
index 0000000..514be15
--- /dev/null
+++ b/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXPluginTest.kt
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2022 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 androidx.build
+
+import androidx.build.AndroidXPluginTestContext.Companion.fileList
+import androidx.build.AndroidXSelfTestProject.Companion.cubaneBuildGradleText
+import androidx.build.AndroidXSelfTestProject.Companion.cubaneKmpNoJavaProject
+import androidx.build.AndroidXSelfTestProject.Companion.cubaneProject
+import net.saff.checkmark.Checkmark
+import net.saff.checkmark.Checkmark.Companion.check
+import org.junit.Test
+
+class AndroidXPluginTest {
+ @Test
+ fun createZipForSimpleProject() = pluginTest {
+ writeBuildFiles(cubaneProject)
+
+ val output = runGradle(":cubane:cubane:createProjectZip", "--stacktrace").output
+ Checkmark.checks {
+ output.check { it.contains("BUILD SUCCESSFUL") }
+ outDir.check { it.fileList().contains("dist") }
+ outDir.resolve("dist/per-project-zips").fileList()
+ .check { it.contains("cubane-cubane-all-0-1.2.3.zip") }
+ }
+ }
+
+ @Test
+ fun variants() = pluginTest {
+ writeBuildFiles(cubaneProject)
+ runGradle(":cubane:cubane:outgoingVariants", "--stacktrace").output.check {
+ it.contains("Variant sourcesElements")
+ }
+ }
+
+ @Test
+ fun publishWithNoJavaWithMultiplatformFlag() = pluginTest {
+ // Make sure we generate a sourceJar without invoking the java plugin
+ writeBuildFiles(cubaneKmpNoJavaProject)
+ cubaneKmpNoJavaProject.publishMavenLocal(
+ "-Pandroidx.compose.multiplatformEnabled=true"
+ )
+ }
+
+ @Test
+ fun androidLibraryAndKotlinAndroid() = pluginTest {
+ val project = cubaneProject.copy(
+ buildGradleText = cubaneBuildGradleText(
+ listOf("com.android.library", "kotlin-android")
+ )
+ )
+ writeBuildFiles(project)
+ project.checkConfigurationSucceeds()
+ }
+
+ @Test
+ fun kotlinAndroidAndAndroidLibrary() = pluginTest {
+ val project = cubaneProject.copy(
+ buildGradleText = cubaneBuildGradleText(
+ listOf("kotlin-android", "com.android.library")
+ )
+ )
+ writeBuildFiles(project)
+ project.checkConfigurationSucceeds()
+ }
+
+ @Test
+ fun androidSampleApplicationWithoutVersion() = pluginTest {
+ val project = cubaneProject.copy(
+ buildGradleText = cubaneBuildGradleText(
+ pluginsBeforeAndroidX = listOf(
+ "com.android.application",
+ "org.jetbrains.kotlin.android"
+ ),
+ version = null
+ )
+ )
+ writeBuildFiles(project)
+ project.checkConfigurationSucceeds()
+ }
+}
\ No newline at end of file
diff --git a/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXPluginTestContext.kt b/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXPluginTestContext.kt
index b869213..94dd541 100644
--- a/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXPluginTestContext.kt
+++ b/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXPluginTestContext.kt
@@ -19,6 +19,8 @@
import androidx.build.AndroidXPluginTestContext.Companion.wrap
import androidx.testutils.gradle.ProjectSetupRule
import java.io.File
+import net.saff.checkmark.Checkmark.Companion.check
+import net.saff.checkmark.Checkmark.Companion.checks
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.junit.rules.TemporaryFolder
@@ -36,7 +38,11 @@
fun pluginTest(action: AndroidXPluginTestContext.() -> Unit) {
TemporaryFolder().wrap { tmpFolder ->
ProjectSetupRule().wrap { setup ->
- AndroidXPluginTestContext(tmpFolder, setup).action()
+ val context = AndroidXPluginTestContext(tmpFolder, setup)
+ // checks: automatically capture context on failure
+ checks {
+ context.action()
+ }
}
}
}
@@ -48,21 +54,12 @@
* cleaned up after the test.
* @param setup: Gradle project setup (see [ProjectSetupRule])
*/
-data class AndroidXPluginTestContext(
- private val tmpFolder: TemporaryFolder,
- val setup: ProjectSetupRule
-) {
- override fun toString() =
- mapOf("tmpFolder" to tmpFolder.root, "settings" to settingsWritten).toString()
-
+data class AndroidXPluginTestContext(val tmpFolder: TemporaryFolder, val setup: ProjectSetupRule) {
private val props = setup.props
-
- // Might be something like $HOME/src/androidx-main/out/buildSrc
- private val outBuildSrc = File(props.buildSrcOutPath)
- val privateJar = outBuildSrc.resolve("private/build/libs/private.jar")
- private val publicJar = outBuildSrc.resolve("public/build/libs/public.jar")
+ val buildJars = BuildJars(props.buildSrcOutPath)
val outDir: File by lazy { tmpFolder.newFolder() }
+ private val mavenLocalDir: File by lazy { tmpFolder.newFolder() }
// Gradle sometimes canonicalizes this path, so we have to or things don't match up.
val supportRoot: File = setup.rootDir.canonicalFile
@@ -71,28 +68,18 @@
// Empty environment so that the host environment does not leak through
val env = mapOf<String, String>()
return GradleRunner.create().withProjectDir(supportRoot)
- .withArguments(*args).withEnvironment(env).build()
+ .withArguments(
+ "-Dmaven.repo.local=$mavenLocalDir",
+ "-P$ALLOW_MISSING_LINT_CHECKS_PROJECT=true",
+ *args
+ )
+ .withEnvironment(env).withEnvironment(env).build()
}
- private var settingsWritten: String? = null
-
- fun writeRootSettingsFile(vararg projectPaths: String) {
- val settingsString = buildString {
- append(
- """|pluginManagement {
- | repositories {
- | ${setup.defaultRepoLines}
- | }
- |}
- |""".trimMargin()
- )
- appendLine()
- projectPaths.forEach {
- appendLine("include(\"$it\")")
- }
+ fun AndroidXSelfTestProject.checkConfigurationSucceeds() {
+ runGradle(":$groupId:$artifactId:tasks", "--stacktrace").output.check {
+ it.contains("BUILD SUCCESSFUL")
}
- settingsWritten = settingsString
- File(setup.rootDir, "settings.gradle").writeText(settingsString)
}
private val prebuiltsPath = supportRoot.resolve("../../prebuilts").path
@@ -111,11 +98,7 @@
| ${setup.repositories}
|
| dependencies {
- | // Needed for androidx extension
- | classpath(project.files("${privateJar.path}"))
- |
- | // Needed for androidx/build/gradle/ExtensionsKt, among others
- | classpath(project.files("${publicJar.path}"))
+ | ${buildJars.classpathEntries()}
|
| classpath '${props.agpDependency}'
| classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:${props.kotlinVersion}'
@@ -132,6 +115,13 @@
|
| // Needed for ZipFile
| classpath('org.apache.ant:ant:1.10.11')
+ |
+ | // Needed for docs-public
+ | classpath('org.jetbrains.dokka:dokka-gradle-plugin:0.9.17-g014')
+ | classpath('org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.17-g014')
+ |
+ | // Otherwise, comments get stripped from poms (b/230396269)
+ | classpath('xerces:xercesImpl:2.12.0')
| }
|}
|
@@ -142,6 +132,53 @@
File(setup.rootDir, "build.gradle").writeText(buildGradleText)
}
+ private fun makeProjectFolder(path: String): File {
+ val projectFolder = setup.rootDir.resolve(path)
+ projectFolder.mkdirs()
+ return projectFolder
+ }
+
+ /**
+ * Convenience function that can be added to a test when debugging and wanting to browse the
+ * output
+ */
+ fun saveMavenFoldersForDebugging(where: String) {
+ mavenLocalDir.copyRecursively(File(where).also {
+ it.deleteRecursively()
+ it.mkdirs()
+ }, true)
+ }
+
+ fun AndroidXSelfTestProject.writeFiles() {
+ val projectFolder = makeProjectFolder(relativePath)
+ File(projectFolder, "build.gradle").writeText(buildGradleText)
+ }
+
+ fun AndroidXSelfTestProject.publishMavenLocal(vararg prefixArgs: String) {
+ val args = arrayOf(*prefixArgs) + arrayOf(
+ ":$groupId:$artifactId:publishToMavenLocal",
+ "--stacktrace"
+ )
+ runGradle(*args).output.check { it.contains("BUILD SUCCESSFUL") }
+ }
+
+ fun AndroidXSelfTestProject.readPublishedFile(fileName: String) =
+ mavenLocalDir.resolve("$groupId/$artifactId/$version/$fileName").readText()
+
+ override fun toString(): String {
+ return buildMap {
+ put("root files", setup.rootDir.list().orEmpty().toList())
+ setup.rootDir.listFiles().orEmpty().filter { it.isDirectory }.forEach { maybeGroupDir ->
+ maybeGroupDir.listFiles().orEmpty().filter { it.isDirectory }.forEach {
+ val maybeBuildFile = it.resolve("build.gradle")
+ if (maybeBuildFile.exists()) {
+ put(it.name + "/build.gradle", maybeBuildFile.readText())
+ }
+ }
+ }
+ }.toString()
+ }
+
companion object {
/**
* JUnit 4 [TestRule]s are traditionally added to a test class as public JVM fields
@@ -154,5 +191,7 @@
fun <T : TestRule> T.wrap(fn: (T) -> Unit) = apply(object : Statement() {
override fun evaluate() = fn(this@wrap)
}, Description.EMPTY).evaluate()
+
+ fun File.fileList() = list()!!.toList()
}
}
\ No newline at end of file
diff --git a/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXRootPluginTest.kt b/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXRootPluginTest.kt
index ef01173..bb8f4eb 100644
--- a/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXRootPluginTest.kt
+++ b/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXRootPluginTest.kt
@@ -16,82 +16,132 @@
package androidx.build
-import java.io.File
+import androidx.build.AndroidXPluginTestContext.Companion.fileList
+import androidx.build.AndroidXSelfTestProject.Companion.cubaneKmpProject
+import androidx.build.AndroidXSelfTestProject.Companion.cubaneProject
import net.saff.checkmark.Checkmark.Companion.check
-import net.saff.checkmark.Checkmark.Companion.checks
import org.junit.Assert
import org.junit.Test
class AndroidXRootPluginTest {
@Test
fun rootProjectConfigurationHasAndroidXTasks() = pluginTest {
- writeRootSettingsFile()
- writeRootBuildFile()
- Assert.assertTrue(privateJar.path, privateJar.exists())
+ writeBuildFiles()
+
+ // Check that our classpath jars exist
+ Assert.assertTrue(buildJars.privateJar.path, buildJars.privateJar.exists())
// --stacktrace gives more details on failure.
- runGradle("tasks", "--stacktrace").output.check {
+ runGradle(
+ "tasks",
+ "--stacktrace",
+ "-P$ALLOW_MISSING_LINT_CHECKS_PROJECT=true"
+ ).output.check {
it.contains("listAndroidXProperties - Lists AndroidX-specific properties")
}
}
@Test
- fun createZipForSimpleProject() = pluginTest {
- writeRootSettingsFile(":cubane:cubane")
- writeRootBuildFile()
+ fun unzipSourcesWithNoProjects() = pluginTest {
+ setupDocsProjects()
- File(supportRoot, "libraryversions.toml").writeText(
- """|[groups]
- |[versions]
- |""".trimMargin()
- )
-
- val projectFolder = setup.rootDir.resolve("cubane/cubane")
-
- checks {
- projectFolder.mkdirs()
-
- // TODO(b/233089408): avoid full path for androidx.build.AndroidXImplPlugin
- File(projectFolder, "build.gradle").writeText(
- """|import androidx.build.LibraryGroup
- |import androidx.build.Publish
- |import androidx.build.Version
- |
- |plugins {
- | // b/233089408: would prefer to use this syntax, but it fails
- | // id("AndroidXPlugin")
- | id("java-library")
- | id("kotlin")
- |}
- |
- |// Workaround for b/233089408
- |apply plugin: androidx.build.AndroidXImplPlugin
- |
- |dependencies {
- | api(libs.kotlinStdlib)
- |}
- |
- |androidx {
- | publish = Publish.SNAPSHOT_AND_RELEASE
- | mavenVersion = new Version("1.2.3")
- | mavenGroup = new LibraryGroup("cubane", null)
- |}
- |""".trimMargin()
- )
-
- val output = runGradle(
- ":cubane:cubane:createProjectZip",
- "--stacktrace",
- "-P$ALLOW_MISSING_LINT_CHECKS_PROJECT=true"
- ).output
- checks {
- output.check { it.contains("BUILD SUCCESSFUL") }
- outDir.check { it.fileList().contains("dist") }
- outDir.resolve("dist/per-project-zips").fileList()
- .check { it.contains("cubane-cubane-all-0-1.2.3.zip") }
- }
+ runGradle(":docs-public:unzipSourcesForDackka", "--stacktrace").output.check {
+ it.contains("BUILD SUCCESSFUL")
}
}
- private fun File.fileList() = list()!!.toList()
+ @Test
+ fun unzipSourcesWithCubane() = pluginTest {
+ setupDocsProjects(cubaneProject)
+ cubaneProject.publishMavenLocal()
+ runGradle(":docs-public:unzipSourcesForDackka", "--stacktrace").output.check {
+ it.contains("BUILD SUCCESSFUL")
+ }
+ }
+
+ @Test
+ fun unzipSourcesWithCubaneKmp() = pluginTest {
+ setupDocsProjects(cubaneKmpProject)
+
+ runGradle(":cubane:cubanekmp:tasks", "--all", "--stacktrace").output.check {
+ it.contains("publishJvmPublicationToMavenLocal")
+ }
+
+ cubaneKmpProject.publishMavenLocal()
+
+ // Make sure we are using metadata, not pom (unfortunately, if we use pom, and don't check,
+ // this test passes without testing the things we actually want to know)
+ // (See b/230396269)
+ cubaneKmpProject.readPublishedFile("cubanekmp-1.2.3.pom")
+ .check { it.contains("do_not_remove: published-with-gradle-metadata") }
+
+ cubaneKmpProject.readPublishedFile("cubanekmp-1.2.3.module")
+ .check { it.contains("\"org.gradle.docstype\": \"sources\"") }
+
+ runGradle(":docs-public:unzipSourcesForDackka", "--stacktrace").output.check {
+ it.contains("BUILD SUCCESSFUL")
+ }
+ }
+
+ @Test
+ fun testSaveMavenFoldersForDebugging() = pluginTest {
+ setupDocsProjects(cubaneProject)
+ cubaneProject.publishMavenLocal()
+
+ val where = tmpFolder.newFolder()
+ saveMavenFoldersForDebugging(where.path)
+ where.fileList().check { it.contains("cubane") }
+ }
+
+ @Test
+ fun testPublishNoDuplicates() = pluginTest {
+ setupDocsProjects(cubaneKmpProject)
+
+ runGradle(":cubane:cubanekmp:publish", "--stacktrace").output.check {
+ // If we have overlapping publications, it will print an error message like
+ // """
+ // Multiple publications with coordinates
+ // 'androidx.collection:collection:1.3.0-alpha01' are published to repository 'maven'.
+ // The publications 'kotlinMultiplatform' in project ':collection:collection' and
+ // 'sourcesMaven' in project ':collection:collection' will overwrite each other!
+ // """
+ !it.contains("will overwrite each other")
+ }
+ }
+
+ private fun AndroidXPluginTestContext.setupDocsProjects(
+ vararg projects: AndroidXSelfTestProject
+ ) {
+ val sourceDependencies = projects.map { it.sourceCoordinate }
+ val docsPublicBuildGradle =
+ """|plugins {
+ | id("com.android.library")
+ |}
+ |
+ |// b/233089408: would prefer to use plugins { id } syntax, but work around.
+ |apply plugin: androidx.build.docs.AndroidXDocsImplPlugin
+ |
+ |repositories {
+ | mavenLocal()
+ |}
+ |
+ |dependencies {
+ | ${sourceDependencies.joinToString("\n") { "docs(\"$it\")" }}
+ |}
+ |""".trimMargin()
+
+ val docsPublicProject = AndroidXSelfTestProject(
+ groupId = "docs-public",
+ artifactId = null,
+ version = null,
+ buildGradleText = docsPublicBuildGradle
+ )
+ val fakeAnnotations = AndroidXSelfTestProject(
+ groupId = "fakeannotations",
+ artifactId = null,
+ version = null,
+ buildGradleText = ""
+ )
+ writeBuildFiles(projects.toList() + listOf(docsPublicProject, fakeAnnotations))
+ }
}
\ No newline at end of file
diff --git a/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXSelfTestProject.kt b/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXSelfTestProject.kt
new file mode 100644
index 0000000..af5c494
--- /dev/null
+++ b/buildSrc-tests/src/test/kotlin/androidx/build/AndroidXSelfTestProject.kt
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2022 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 androidx.build
+
+data class AndroidXSelfTestProject(
+ val groupId: String,
+ val artifactId: String?,
+ val version: String?,
+ val buildGradleText: String
+) {
+ val relativePath = artifactId?.let { "$groupId/$artifactId" } ?: groupId
+ val gradlePath = ":$groupId:$artifactId"
+ val sourceCoordinate get() = "$groupId:$artifactId:${version!!}"
+
+ companion object {
+ // TODO(b/233089408): avoid full path for androidx.build.AndroidXImplPlugin
+ fun cubaneBuildGradleText(
+ pluginsBeforeAndroidX: List<String> = listOf("java-library", "kotlin"),
+ version: String? = "1.2.3"
+ ) =
+ """|import androidx.build.LibraryGroup
+ |import androidx.build.Publish
+ |import androidx.build.Version
+ |
+ |plugins {
+ | // b/233089408: would prefer to use this syntax, but it fails
+ | // id("AndroidXPlugin")
+ |${pluginsBeforeAndroidX.joinToString("") { " id(\"$it\")\n" }}
+ |}
+ |
+ |// Workaround for b/233089408
+ |apply plugin: androidx.build.AndroidXImplPlugin
+ |
+ |dependencies {
+ | api(libs.kotlinStdlib)
+ |}
+ |
+ |androidx {
+ | publish = Publish.SNAPSHOT_AND_RELEASE
+ |${if (version != null) {" mavenVersion = new Version(\"$version\")"} else ""}
+ | mavenGroup = new LibraryGroup("cubane", null)
+ |}
+ |""".trimMargin()
+
+ /**
+ * A simple non-kmp project with no source that will be part of our test androidx suite.
+ * ("Cubane" is literally a random word from wikipedia. It "is a synthetic hydrocarbon
+ * molecule that consists of eight carbon atoms")
+ */
+ val cubaneProject =
+ AndroidXSelfTestProject(
+ groupId = "cubane",
+ artifactId = "cubane",
+ version = "1.2.3",
+ buildGradleText = cubaneBuildGradleText()
+ )
+
+ private fun buildGradleForKmp(withJava: Boolean = true) =
+ """|import androidx.build.LibraryGroup
+ |import androidx.build.LibraryType
+ |import androidx.build.Publish
+ |import androidx.build.Version
+ |
+ |plugins {
+ | // b/233089408: would prefer to use this syntax, but it fails
+ | // id("AndroidXPlugin")
+ | id("org.jetbrains.kotlin.multiplatform")
+ |}
+ |
+ |// Workaround for b/233089408
+ |apply plugin: androidx.build.AndroidXImplPlugin
+ |
+ |kotlin {
+ | jvm {
+ | ${if (withJava) "withJava()" else ""}
+ | }
+ |}
+ |
+ |androidx {
+ | type = LibraryType.kmpLibrary {
+ | jvm = Publish.SNAPSHOT_AND_RELEASE
+ | }
+ | mavenVersion = new Version("1.2.3")
+ | mavenGroup = new LibraryGroup("cubane", null)
+ |}
+ |""".trimMargin()
+
+ /**
+ * A simple KMP project with no actual source that will be part of our test androidx suite.
+ */
+ val cubaneKmpProject = AndroidXSelfTestProject(
+ groupId = "cubane",
+ artifactId = "cubanekmp",
+ version = "1.2.3",
+ buildGradleText = buildGradleForKmp(withJava = true)
+ )
+
+ /**
+ * A simple KMP project with no actual source and no java sourceSet.
+ * (This means that JavaPlugin code paths will not be triggered)
+ */
+ val cubaneKmpNoJavaProject = AndroidXSelfTestProject(
+ groupId = "cubane",
+ artifactId = "cubaneNoJava",
+ version = "1.2.3",
+ buildGradleText = buildGradleForKmp(withJava = false)
+ )
+ }
+}
\ No newline at end of file
diff --git a/buildSrc-tests/src/test/kotlin/androidx/build/BuildJars.kt b/buildSrc-tests/src/test/kotlin/androidx/build/BuildJars.kt
new file mode 100644
index 0000000..0a4c54d
--- /dev/null
+++ b/buildSrc-tests/src/test/kotlin/androidx/build/BuildJars.kt
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 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 androidx.build
+
+import java.io.File
+
+/**
+ * The self-built jars that we need to successfully apply the plugin
+ *
+ * @param outBuildSrcPath: Might be something like $HOME/src/androidx-main/out/buildSrc
+ */
+class BuildJars(private val outBuildSrcPath: String) {
+ private val outBuildSrc = File(outBuildSrcPath)
+
+ val privateJar = outBuildSrc.resolve("private/build/libs/private.jar")
+ private val publicJar = outBuildSrc.resolve("public/build/libs/public.jar")
+ private val jetpadIntegrationJar =
+ outBuildSrc.resolve("jetpad-integration/build/libs/jetpad-integration.jar")
+
+ fun classpathEntries(): String {
+ return """|// Needed for androidx extension
+ |classpath(project.files("${privateJar.path}"))
+ |
+ |// Needed for androidx/build/gradle/ExtensionsKt, among others
+ |classpath(project.files("${publicJar.path}"))
+ |
+ |// Needed for androidx/build/jetpad/LibraryBuildInfoFile
+ |classpath(project.files("${jetpadIntegrationJar.path}"))
+ |""".trimMargin()
+ }
+}
\ No newline at end of file
diff --git a/buildSrc-tests/src/test/kotlin/androidx/build/buildFiles.kt b/buildSrc-tests/src/test/kotlin/androidx/build/buildFiles.kt
new file mode 100644
index 0000000..72a3e56
--- /dev/null
+++ b/buildSrc-tests/src/test/kotlin/androidx/build/buildFiles.kt
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2022 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 androidx.build
+
+import java.io.File
+
+fun AndroidXPluginTestContext.writeBuildFiles(vararg projects: AndroidXSelfTestProject) {
+ writeBuildFiles(projects.toList())
+}
+
+fun AndroidXPluginTestContext.writeBuildFiles(projects: List<AndroidXSelfTestProject>) {
+ writeRootSettingsFile(projects.map { it.gradlePath })
+ writeRootBuildFile()
+
+ File(supportRoot, "libraryversions.toml").writeText(
+ """|[groups]
+ |[versions]
+ |""".trimMargin()
+ )
+
+ // Matches behavior of root properties
+ File(supportRoot, "gradle.properties").writeText(
+ """|# Do not automatically include stdlib
+ |kotlin.stdlib.default.dependency=false
+ |
+ |# Avoid OOM in subgradle
+ |# (https://github.com/gradle/gradle/issues/10527#issuecomment-887704062)
+ |org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=1g
+ |""".trimMargin()
+ )
+
+ projects.forEach { it.writeFiles() }
+}
+
+fun AndroidXPluginTestContext.writeRootSettingsFile(projectPaths: List<String>) {
+ val settingsString = buildString {
+ append(
+ """|pluginManagement {
+ | ${setup.repositories}
+ |}
+ |""".trimMargin()
+ )
+ appendLine()
+ projectPaths.forEach {
+ appendLine("include(\"$it\")")
+ }
+ }
+ File(setup.rootDir, "settings.gradle").writeText(settingsString)
+}
\ No newline at end of file
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt
index 223e991..0930a5f 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt
@@ -85,6 +85,8 @@
import java.time.Duration
import java.util.Locale
import java.util.concurrent.ConcurrentHashMap
+import javax.inject.Inject
+import org.gradle.api.component.SoftwareComponentFactory
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.kotlin.dsl.KotlinClosure1
import org.gradle.kotlin.dsl.register
@@ -96,7 +98,9 @@
* A plugin which enables all of the Gradle customizations for AndroidX.
* This plugin reacts to other plugins being added and adds required and optional functionality.
*/
-class AndroidXImplPlugin : Plugin<Project> {
+
+class AndroidXImplPlugin @Inject constructor(val componentFactory: SoftwareComponentFactory) :
+ Plugin<Project> {
override fun apply(project: Project) {
if (project.isRoot)
throw Exception("Root project should use AndroidXRootImplPlugin instead")
@@ -123,7 +127,7 @@
project.tasks.withType(Test::class.java) { task -> configureTestTask(project, task) }
project.configureTaskTimeouts()
- project.configureMavenArtifactUpload(extension)
+ project.configureMavenArtifactUpload(extension, componentFactory)
project.configureExternalDependencyLicenseCheck()
project.configureProjectStructureValidation(extension)
project.configureProjectVersionValidation(extension)
@@ -274,6 +278,16 @@
)
}
+ // If no one else is going to register a source jar, then we should.
+ // This cross-plugin hands-off logic shouldn't be necessary once we clean up sourceSet
+ // logic (b/235828421)
+ // If this is done outside of afterEvaluate, then we don't always get the right answer,
+ // but due to b/233089408 we don't currently have a way to test that.
+ if (!project.plugins.hasPlugin(LibraryPlugin::class.java) &&
+ !project.plugins.hasPlugin(JavaPlugin::class.java)) {
+ project.configureSourceJarForJava()
+ }
+
val isAndroidProject = project.plugins.hasPlugin(LibraryPlugin::class.java) ||
project.plugins.hasPlugin(AppPlugin::class.java)
// Explicit API mode is broken for Android projects
@@ -1071,7 +1085,11 @@
// Project directory should match the Maven coordinate.
val expectDir = shortGroupId.replace(".", File.separator) +
"${File.separator}${project.name}"
- val actualDir = project.projectDir.toRelativeString(project.getSupportRootFolder())
+ // Canonical projectDir is needed because sometimes, at least in tests, on OSX, supportRoot
+ // starts with /var, and projectDir starts with /private/var (which are the same thing)
+ val canonicalProjectDir = project.projectDir.canonicalFile
+ val actualDir =
+ canonicalProjectDir.toRelativeString(project.getSupportRootFolder().canonicalFile)
if (expectDir != actualDir) {
throw GradleException(
"Invalid project structure! Expected $expectDir as project directory, found $actualDir"
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt b/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt
index 9844e82..67d020f 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt
@@ -200,6 +200,9 @@
fatal.add("VisibleForTests")
}
+ // Reenable after b/235251897 is resolved
+ disable.add("IllegalExperimentalApiUsage")
+
// Disable dependency checks that suggest to change them. We want libraries to be
// intentional with their dependency version bumps.
disable.add("KtxExtensionAvailable")
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt b/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt
index 53db749..6774607 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt
@@ -36,7 +36,12 @@
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.XmlProvider
+import org.gradle.api.attributes.DocsType
+import org.gradle.api.component.ComponentWithVariants
import org.gradle.api.component.SoftwareComponent
+import org.gradle.api.component.SoftwareComponentFactory
+import org.gradle.api.internal.component.SoftwareComponentInternal
+import org.gradle.api.internal.component.UsageContext
import org.gradle.api.provider.Provider
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPom
@@ -51,21 +56,44 @@
import org.xml.sax.InputSource
import org.xml.sax.XMLReader
-fun Project.configureMavenArtifactUpload(extension: AndroidXExtension) {
+fun Project.configureMavenArtifactUpload(
+ extension: AndroidXExtension,
+ componentFactory: SoftwareComponentFactory
+) {
apply(mapOf("plugin" to "maven-publish"))
+ var registered = false
+ fun registerOnFirstPublishableArtifact() {
+ if (!registered) {
+ Release.register(this, extension)
+ registered = true
+ }
+ }
afterEvaluate {
components.all { component ->
- configureComponent(extension, component)
+ if (configureJvmComponentPublishing(extension, component))
+ registerOnFirstPublishableArtifact()
+ }
+
+ if (project.isMultiplatformPublicationEnabled()) {
+ configureMultiplatformPublication(componentFactory)
+ registerOnFirstPublishableArtifact()
}
}
}
-private fun Project.configureComponent(
+/**
+ * Configure publishing for a JVM-based component.
+ *
+ * @return true iff a valid publication is created
+ */
+private fun Project.configureJvmComponentPublishing(
extension: AndroidXExtension,
component: SoftwareComponent
-) {
- if (extension.shouldPublish() && component.isAndroidOrJavaReleaseComponent()) {
+): Boolean {
+ val publishThisComponent =
+ extension.shouldPublish() && component.isAndroidOrJavaReleaseComponent()
+ if (publishThisComponent) {
val androidxGroup = validateCoordinatesAndGetGroup(extension)
val projectArchiveDir = File(
getRepositoryDirectory(),
@@ -125,9 +153,6 @@
}
}
- // Register it as part of release so that we create a Zip file for it
- Release.register(this, extension)
-
// Workarounds for https://github.com/gradle/gradle/issues/20011
project.tasks.withType(GenerateModuleMetadata::class.java).configureEach { task ->
task.doLast {
@@ -165,11 +190,8 @@
)
}
}
-
- if (project.isMultiplatformPublicationEnabled()) {
- configureMultiplatformPublication()
- }
}
+ return publishThisComponent
}
/**
@@ -286,7 +308,7 @@
return extensions.findByType<KotlinMultiplatformExtension>() != null
}
-private fun Project.configureMultiplatformPublication() {
+private fun Project.configureMultiplatformPublication(componentFactory: SoftwareComponentFactory) {
val multiplatformExtension = extensions.findByType<KotlinMultiplatformExtension>()!!
multiplatformExtension.targets.all { target ->
@@ -294,6 +316,82 @@
target.publishAllLibraryVariants()
}
}
+
+ replaceBaseMultiplatformPublication(componentFactory)
+}
+
+/**
+ * KMP does not include a sources configuration (b/235486368), so we replace it with our own
+ * publication that includes it. This uses internal API as a workaround while waiting for a fix
+ * on the original bug.
+ */
+private fun Project.replaceBaseMultiplatformPublication(
+ componentFactory: SoftwareComponentFactory
+) {
+ withSourcesComponent(componentFactory) { sourcesComponent ->
+ val kotlinComponent = components.findByName("kotlin") as SoftwareComponentInternal
+
+ configure<PublishingExtension> {
+ publications { pubs ->
+ pubs.create<MavenPublication>("androidxKmp") {
+ from(object : ComponentWithVariants, SoftwareComponentInternal {
+ override fun getName(): String {
+ return "androidxKmp"
+ }
+
+ override fun getUsages(): MutableSet<out UsageContext> {
+ // Include sources artifact we built and root artifacts from kotlin plugin.
+ return (sourcesComponent.usages + kotlinComponent.usages).toMutableSet()
+ }
+
+ override fun getVariants(): MutableSet<out SoftwareComponent> {
+ // Include all target-based variants from kotlin plugin.
+ return (kotlinComponent as ComponentWithVariants).variants
+ }
+ })
+ }
+ }
+ }
+
+ disableBaseKmpPublications()
+ }
+}
+
+/**
+ * If a source configuration is currently in the project, or eventually gets added, run the given
+ * configuration with it.
+ */
+private fun Project.withSourcesComponent(
+ componentFactory: SoftwareComponentFactory,
+ action: (SoftwareComponentInternal) -> Unit
+) {
+ configurations.configureEach {
+ if (it.attributes.getAttribute(DocsType.DOCS_TYPE_ATTRIBUTE)?.name == DocsType.SOURCES) {
+ // "adhoc" is gradle terminology; it refers to a component with arbitrary included
+ // variants, which is what we want to build. The name need only be unique within the
+ // project
+ val androidxSourceComponentName = "androidxJvmSources"
+ val component = componentFactory.adhoc(androidxSourceComponentName).apply {
+ addVariantsFromConfiguration(it) {}
+ } as SoftwareComponentInternal
+ action(component)
+ }
+ }
+}
+
+/**
+ * Now that we have created our own publication that we want published, prevent the base publication
+ * from being published using the roll-up tasks. We should be able to remove this workaround when
+ * b/235486368 is fixed.
+ */
+private fun Project.disableBaseKmpPublications() {
+ listOf("publish", "publishToMavenLocal").forEach { taskName ->
+ tasks.named(taskName).configure { publishTask ->
+ publishTask.setDependsOn(publishTask.dependsOn.filterNot {
+ (it as String).startsWith("publishKotlinMultiplatform")
+ })
+ }
+ }
}
private fun SoftwareComponent.isAndroidOrJavaReleaseComponent() =
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/Release.kt b/buildSrc/private/src/main/kotlin/androidx/build/Release.kt
index 8bea010..8a7ba98 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/Release.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/Release.kt
@@ -168,7 +168,7 @@
)
return
}
- if (!extension.shouldRelease()) {
+ if (!extension.shouldRelease() && !isSnapshotBuild()) {
project.logger.info(
"project ${project.name} isn't part of release, because its" +
" \"publish\" property is SNAPSHOT_ONLY, but it is not a snapshot build"
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/SourceJarTaskHelper.kt b/buildSrc/private/src/main/kotlin/androidx/build/SourceJarTaskHelper.kt
index e396ccc..cca0bf6 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/SourceJarTaskHelper.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/SourceJarTaskHelper.kt
@@ -89,7 +89,12 @@
task.duplicatesStrategy = DuplicatesStrategy.FAIL
extensions.findByType(JavaPluginExtension::class.java)?.let { extension ->
- task.from(extension.sourceSets.getByName("main").allSource.srcDirs)
+ // Since KotlinPlugin applies JavaPlugin, it's possible for JavaPlugin to exist, but
+ // not to have "main". Eventually, we should stop expecting to grab sourceSets by name
+ // (b/235828421)
+ extension.sourceSets.findByName("main")?.let {
+ task.from(it.allSource.srcDirs)
+ }
}
extensions.findByType(KotlinMultiplatformExtension::class.java)?.let { extension ->
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/AndroidManifest.xml b/camera/integration-tests/uiwidgetstestapp/src/main/AndroidManifest.xml
index 13e2628..10f572a 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/AndroidManifest.xml
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/AndroidManifest.xml
@@ -66,7 +66,9 @@
android:label="Compose"/>
</application>
+ <uses-feature android:name="android.hardware.camera.any" />
<uses-permission android:name="android.permission.CAMERA" />
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
\ No newline at end of file
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ComposeCameraActivity.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ComposeCameraActivity.kt
index 3dcab7a..3837653 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ComposeCameraActivity.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ComposeCameraActivity.kt
@@ -16,16 +16,45 @@
package androidx.camera.integration.uiwidgets.compose
+import android.Manifest
+import android.content.pm.PackageManager
+import android.os.Build
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.camera.integration.uiwidgets.compose.ui.ComposeCameraApp
+import androidx.camera.integration.uiwidgets.compose.ui.PermissionsUI
+import androidx.core.content.ContextCompat
class ComposeCameraActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
- ComposeCameraApp()
+ PermissionsUI(
+ permissions = REQUIRED_PERMISSIONS,
+ checkAllPermissionGranted = {
+ checkAllPermissionsGranted(it)
+ }
+ ) {
+ ComposeCameraApp()
+ }
}
}
+
+ private fun checkAllPermissionsGranted(permissions: Array<String>): Boolean {
+ return permissions.all {
+ ContextCompat.checkSelfPermission(baseContext, it) == PackageManager.PERMISSION_GRANTED
+ }
+ }
+
+ companion object {
+ val REQUIRED_PERMISSIONS = mutableListOf(
+ Manifest.permission.CAMERA,
+ Manifest.permission.RECORD_AUDIO
+ ).apply {
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
+ add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
+ }
+ }.toTypedArray()
+ }
}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/ComposeCameraApp.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/ComposeCameraApp.kt
index 59c6979..026ee4d 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/ComposeCameraApp.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/ComposeCameraApp.kt
@@ -22,7 +22,6 @@
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
-import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.compose.currentBackStackEntryAsState
@@ -57,8 +56,3 @@
}
}
}
-
-@Composable
-fun Greeting() {
- Text("Hello")
-}
\ No newline at end of file
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/PermissionsUI.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/PermissionsUI.kt
new file mode 100644
index 0000000..27af7e9
--- /dev/null
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/PermissionsUI.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2022 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 androidx.camera.integration.uiwidgets.compose.ui
+
+import androidx.activity.compose.rememberLauncherForActivityResult
+import androidx.activity.result.contract.ActivityResultContracts
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+
+@Composable
+fun PermissionsUI(
+ permissions: Array<String>,
+ checkAllPermissionGranted: (Array<String>) -> Boolean,
+ content: @Composable () -> Unit
+) {
+ var allPermissionsGranted by remember { mutableStateOf(checkAllPermissionGranted(permissions)) }
+
+ val launcher = rememberLauncherForActivityResult(
+ contract = ActivityResultContracts.RequestMultiplePermissions()
+ ) { results ->
+ allPermissionsGranted = results.all {
+ it.value
+ }
+ }
+
+ LaunchedEffect(key1 = permissions) {
+ if (!allPermissionsGranted) {
+ launcher.launch(permissions)
+ }
+ }
+
+ if (allPermissionsGranted) {
+ content()
+ } else {
+ Text("Permissions are not granted to the app.")
+ }
+}
\ No newline at end of file
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraNavHost.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraNavHost.kt
index 7516248..cc6c150 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraNavHost.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraNavHost.kt
@@ -16,7 +16,9 @@
package androidx.camera.integration.uiwidgets.compose.ui.navigation
-import androidx.camera.integration.uiwidgets.compose.ui.Greeting
+import androidx.camera.integration.uiwidgets.compose.ui.screen.gallery.GalleryScreen
+import androidx.camera.integration.uiwidgets.compose.ui.screen.imagecapture.ImageCaptureScreen
+import androidx.camera.integration.uiwidgets.compose.ui.screen.videocapture.VideoCaptureScreen
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
@@ -34,15 +36,15 @@
modifier = modifier
) {
composable(ComposeCameraScreen.ImageCapture.name) {
- Greeting()
+ ImageCaptureScreen()
}
composable(ComposeCameraScreen.VideoCapture.name) {
- Greeting()
+ VideoCaptureScreen()
}
composable(ComposeCameraScreen.Gallery.name) {
- Greeting()
+ GalleryScreen()
}
}
}
\ No newline at end of file
diff --git a/lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsKotlin.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/gallery/GalleryScreen.kt
similarity index 67%
copy from lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsKotlin.kt
copy to camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/gallery/GalleryScreen.kt
index 3f57835..fdc9e2d 100644
--- a/lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsKotlin.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/gallery/GalleryScreen.kt
@@ -14,14 +14,12 @@
* limitations under the License.
*/
-package androidx.sample
+package androidx.camera.integration.uiwidgets.compose.ui.screen.gallery
-import org.jetbrains.annotations.NotNull
-import org.jetbrains.annotations.Nullable
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
-@Suppress("unused", "UNUSED_PARAMETER")
-class NullabilityAnnotationsKotlin {
- private fun method1(@NotNull arg: String) {}
-
- private fun method2(@Nullable arg: String?) {}
-}
+@Composable
+fun GalleryScreen() {
+ Text("Gallery Screen")
+}
\ No newline at end of file
diff --git a/lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsKotlin.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreen.kt
similarity index 67%
rename from lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsKotlin.kt
rename to camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreen.kt
index 3f57835..0863a54 100644
--- a/lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsKotlin.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreen.kt
@@ -14,14 +14,12 @@
* limitations under the License.
*/
-package androidx.sample
+package androidx.camera.integration.uiwidgets.compose.ui.screen.imagecapture
-import org.jetbrains.annotations.NotNull
-import org.jetbrains.annotations.Nullable
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
-@Suppress("unused", "UNUSED_PARAMETER")
-class NullabilityAnnotationsKotlin {
- private fun method1(@NotNull arg: String) {}
-
- private fun method2(@Nullable arg: String?) {}
-}
+@Composable
+fun ImageCaptureScreen() {
+ Text("Image Capture Screen")
+}
\ No newline at end of file
diff --git a/lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsKotlin.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreen.kt
similarity index 67%
copy from lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsKotlin.kt
copy to camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreen.kt
index 3f57835..726739f 100644
--- a/lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsKotlin.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreen.kt
@@ -14,14 +14,12 @@
* limitations under the License.
*/
-package androidx.sample
+package androidx.camera.integration.uiwidgets.compose.ui.screen.videocapture
-import org.jetbrains.annotations.NotNull
-import org.jetbrains.annotations.Nullable
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
-@Suppress("unused", "UNUSED_PARAMETER")
-class NullabilityAnnotationsKotlin {
- private fun method1(@NotNull arg: String) {}
-
- private fun method2(@Nullable arg: String?) {}
-}
+@Composable
+fun VideoCaptureScreen() {
+ Text("Video Capture Screen")
+}
\ No newline at end of file
diff --git a/camera/integration-tests/viewfindertestapp/src/main/AndroidManifest.xml b/camera/integration-tests/viewfindertestapp/src/main/AndroidManifest.xml
index 9ceec14..cc49044 100644
--- a/camera/integration-tests/viewfindertestapp/src/main/AndroidManifest.xml
+++ b/camera/integration-tests/viewfindertestapp/src/main/AndroidManifest.xml
@@ -17,6 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.CAMERA" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
diff --git a/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderFoldableFragment.kt b/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderFoldableFragment.kt
index e789c0c..3e15e08 100644
--- a/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderFoldableFragment.kt
+++ b/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderFoldableFragment.kt
@@ -213,6 +213,23 @@
imageReaderThread = HandlerThread("ImageThread").apply { start() }
imageReaderHandler = Handler(imageReaderThread.looper)
+ // Request Permission
+ val cameraPermission = activity?.let {
+ ContextCompat.checkSelfPermission(it, Manifest.permission.CAMERA)
+ }
+ if (cameraPermission != PackageManager.PERMISSION_GRANTED) {
+ requestCameraPermission()
+ return
+ }
+
+ val storagePermission = activity?.let {
+ ContextCompat.checkSelfPermission(it, Manifest.permission.WRITE_EXTERNAL_STORAGE)
+ }
+ if (storagePermission != PackageManager.PERMISSION_GRANTED) {
+ requestStoragePermission()
+ return
+ }
+
sendSurfaceRequest(false)
lifecycleScope.launch {
@@ -255,6 +272,16 @@
}
@Suppress("DEPRECATION")
+ private fun requestStoragePermission() {
+ if (shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
+ ConfirmationDialog().show(childFragmentManager, FRAGMENT_DIALOG)
+ } else {
+ requestPermissions(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
+ REQUEST_CAMERA_PERMISSION)
+ }
+ }
+
+ @Suppress("DEPRECATION")
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
@@ -272,14 +299,6 @@
// ------------- Create Capture Session --------------
private fun sendSurfaceRequest(toggleCamera: Boolean) {
- val permission = activity?.let {
- ContextCompat.checkSelfPermission(it, Manifest.permission.CAMERA)
- }
- if (permission != PackageManager.PERMISSION_GRANTED) {
- requestCameraPermission()
- return
- }
-
cameraViewfinder.post {
if (isAdded && context != null) {
setUpCameraOutputs(toggleCamera)
@@ -372,8 +391,12 @@
// This will keep sending the capture request as frequently as possible until the
// session is torn down or session.stopRepeating() is called
session.setRepeatingRequest(captureRequest.build(), null, cameraHandler)
- } catch (e: UnsupportedOperationException) {
- Log.d(TAG, "createCaptureSession UnsupportedOperationException")
+ } catch (e: CameraAccessException) {
+ Log.e(TAG, "createCaptureSession CameraAccessException")
+ } catch (e: IllegalArgumentException) {
+ Log.e(TAG, "createCaptureSession IllegalArgumentException")
+ } catch (e: SecurityException) {
+ Log.e(TAG, "createCaptureSession SecurityException")
}
}
@@ -383,31 +406,37 @@
cameraId: String,
handler: Handler? = null
): CameraDevice = suspendCancellableCoroutine { cont ->
- manager.openCamera(cameraId, object : CameraDevice.StateCallback() {
- override fun onOpened(device: CameraDevice) {
- cameraOpenCloseLock.release()
- cont.resume(device)
- }
-
- override fun onDisconnected(device: CameraDevice) {
- Log.w(TAG, "Camera $cameraId has been disconnected")
- cameraOpenCloseLock.release()
- }
-
- override fun onError(device: CameraDevice, error: Int) {
- val msg = when (error) {
- ERROR_CAMERA_DEVICE -> "Fatal (device)"
- ERROR_CAMERA_DISABLED -> "Device policy"
- ERROR_CAMERA_IN_USE -> "Camera in use"
- ERROR_CAMERA_SERVICE -> "Fatal (service)"
- ERROR_MAX_CAMERAS_IN_USE -> "Maximum cameras in use"
- else -> "Unknown"
+ try {
+ manager.openCamera(cameraId, object : CameraDevice.StateCallback() {
+ override fun onOpened(device: CameraDevice) {
+ cameraOpenCloseLock.release()
+ cont.resume(device)
}
- val exc = RuntimeException("Camera $cameraId error: ($error) $msg")
- Log.e(TAG, exc.message, exc)
- if (cont.isActive) cont.resumeWithException(exc)
- }
- }, handler)
+
+ override fun onDisconnected(device: CameraDevice) {
+ Log.w(TAG, "Camera $cameraId has been disconnected")
+ cameraOpenCloseLock.release()
+ }
+
+ override fun onError(device: CameraDevice, error: Int) {
+ val msg = when (error) {
+ ERROR_CAMERA_DEVICE -> "Fatal (device)"
+ ERROR_CAMERA_DISABLED -> "Device policy"
+ ERROR_CAMERA_IN_USE -> "Camera in use"
+ ERROR_CAMERA_SERVICE -> "Fatal (service)"
+ ERROR_MAX_CAMERAS_IN_USE -> "Maximum cameras in use"
+ else -> "Unknown"
+ }
+ Log.e(TAG, "Camera $cameraId error: ($error) $msg")
+ }
+ }, handler)
+ } catch (e: CameraAccessException) {
+ Log.e(TAG, "openCamera CameraAccessException")
+ } catch (e: IllegalArgumentException) {
+ Log.e(TAG, "openCamera IllegalArgumentException")
+ } catch (e: SecurityException) {
+ Log.e(TAG, "openCamera SecurityException")
+ }
}
private fun closeCamera() {
diff --git a/cardview/cardview/lint-baseline.xml b/cardview/cardview/lint-baseline.xml
deleted file mode 100644
index 351d5b9..0000000
--- a/cardview/cardview/lint-baseline.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.3.0-alpha07" type="baseline" client="gradle" dependencies="false" name="AGP (7.3.0-alpha07)" variant="all" version="7.3.0-alpha07">
-
- <issue
- id="ResourceType"
- message="Expected resource of type styleable"
- errorLine1=" final TypedArray aa = getContext().obtainStyledAttributes(COLOR_BACKGROUND_ATTR);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/cardview/widget/CardView.java"/>
- </issue>
-
-</issues>
diff --git a/cardview/cardview/src/main/java/androidx/cardview/widget/CardView.java b/cardview/cardview/src/main/java/androidx/cardview/widget/CardView.java
index 91b0d0a..08b5580 100644
--- a/cardview/cardview/src/main/java/androidx/cardview/widget/CardView.java
+++ b/cardview/cardview/src/main/java/androidx/cardview/widget/CardView.java
@@ -16,6 +16,7 @@
package androidx.cardview.widget;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
@@ -130,6 +131,7 @@
backgroundColor = a.getColorStateList(R.styleable.CardView_cardBackgroundColor);
} else {
// There isn't one set, so we'll compute one based on the theme
+ @SuppressLint("ResourceType")
final TypedArray aa = getContext().obtainStyledAttributes(COLOR_BACKGROUND_ATTR);
final int themeColorBackground = aa.getColor(0, 0);
aa.recycle();
diff --git a/collection/collection/src/jvmTest/java/androidx/collection/SparseArrayCompatTest.java b/collection/collection/src/jvmTest/java/androidx/collection/SparseArrayCompatTest.java
index 6a169f69..64717ee 100644
--- a/collection/collection/src/jvmTest/java/androidx/collection/SparseArrayCompatTest.java
+++ b/collection/collection/src/jvmTest/java/androidx/collection/SparseArrayCompatTest.java
@@ -290,4 +290,26 @@
assertEquals(source.valueAt(i), dest.valueAt(i));
}
}
+
+ @Test
+ public void valueAt_nullValue() {
+ SparseArrayCompat<String> source = new SparseArrayCompat<>(10);
+ assertEquals(0, source.size());
+
+ // Succeeds since it is within initialCapacity of SparseArrayCompat.
+ assertNull(source.valueAt(9));
+ }
+
+ @Test
+ public void valueAt_outOfBounds() {
+ SparseArrayCompat<String> source = new SparseArrayCompat<>(10);
+ assertEquals(0, source.size());
+
+ try {
+ // Throws ArrayIndexOutOfBoundsException.
+ source.valueAt(10000);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // Expected
+ }
+ }
}
diff --git a/compose/animation/animation-core/api/1.2.0-beta04.txt b/compose/animation/animation-core/api/1.2.0-beta04.txt
index 5127158..675c92e 100644
--- a/compose/animation/animation-core/api/1.2.0-beta04.txt
+++ b/compose/animation/animation-core/api/1.2.0-beta04.txt
@@ -244,6 +244,74 @@
}
public final class EasingFunctionsKt {
+ method public static androidx.compose.animation.core.Easing getEase();
+ method public static androidx.compose.animation.core.Easing getEaseIn();
+ method public static androidx.compose.animation.core.Easing getEaseInBack();
+ method public static androidx.compose.animation.core.Easing getEaseInBounce();
+ method public static androidx.compose.animation.core.Easing getEaseInCirc();
+ method public static androidx.compose.animation.core.Easing getEaseInCubic();
+ method public static androidx.compose.animation.core.Easing getEaseInElastic();
+ method public static androidx.compose.animation.core.Easing getEaseInExpo();
+ method public static androidx.compose.animation.core.Easing getEaseInOut();
+ method public static androidx.compose.animation.core.Easing getEaseInOutBack();
+ method public static androidx.compose.animation.core.Easing getEaseInOutBounce();
+ method public static androidx.compose.animation.core.Easing getEaseInOutCirc();
+ method public static androidx.compose.animation.core.Easing getEaseInOutCubic();
+ method public static androidx.compose.animation.core.Easing getEaseInOutElastic();
+ method public static androidx.compose.animation.core.Easing getEaseInOutExpo();
+ method public static androidx.compose.animation.core.Easing getEaseInOutQuad();
+ method public static androidx.compose.animation.core.Easing getEaseInOutQuart();
+ method public static androidx.compose.animation.core.Easing getEaseInOutQuint();
+ method public static androidx.compose.animation.core.Easing getEaseInOutSine();
+ method public static androidx.compose.animation.core.Easing getEaseInQuad();
+ method public static androidx.compose.animation.core.Easing getEaseInQuart();
+ method public static androidx.compose.animation.core.Easing getEaseInQuint();
+ method public static androidx.compose.animation.core.Easing getEaseInSine();
+ method public static androidx.compose.animation.core.Easing getEaseOut();
+ method public static androidx.compose.animation.core.Easing getEaseOutBack();
+ method public static androidx.compose.animation.core.Easing getEaseOutBounce();
+ method public static androidx.compose.animation.core.Easing getEaseOutCirc();
+ method public static androidx.compose.animation.core.Easing getEaseOutCubic();
+ method public static androidx.compose.animation.core.Easing getEaseOutElastic();
+ method public static androidx.compose.animation.core.Easing getEaseOutExpo();
+ method public static androidx.compose.animation.core.Easing getEaseOutQuad();
+ method public static androidx.compose.animation.core.Easing getEaseOutQuart();
+ method public static androidx.compose.animation.core.Easing getEaseOutQuint();
+ method public static androidx.compose.animation.core.Easing getEaseOutSine();
+ property public static final androidx.compose.animation.core.Easing Ease;
+ property public static final androidx.compose.animation.core.Easing EaseIn;
+ property public static final androidx.compose.animation.core.Easing EaseInBack;
+ property public static final androidx.compose.animation.core.Easing EaseInBounce;
+ property public static final androidx.compose.animation.core.Easing EaseInCirc;
+ property public static final androidx.compose.animation.core.Easing EaseInCubic;
+ property public static final androidx.compose.animation.core.Easing EaseInElastic;
+ property public static final androidx.compose.animation.core.Easing EaseInExpo;
+ property public static final androidx.compose.animation.core.Easing EaseInOut;
+ property public static final androidx.compose.animation.core.Easing EaseInOutBack;
+ property public static final androidx.compose.animation.core.Easing EaseInOutBounce;
+ property public static final androidx.compose.animation.core.Easing EaseInOutCirc;
+ property public static final androidx.compose.animation.core.Easing EaseInOutCubic;
+ property public static final androidx.compose.animation.core.Easing EaseInOutElastic;
+ property public static final androidx.compose.animation.core.Easing EaseInOutExpo;
+ property public static final androidx.compose.animation.core.Easing EaseInOutQuad;
+ property public static final androidx.compose.animation.core.Easing EaseInOutQuart;
+ property public static final androidx.compose.animation.core.Easing EaseInOutQuint;
+ property public static final androidx.compose.animation.core.Easing EaseInOutSine;
+ property public static final androidx.compose.animation.core.Easing EaseInQuad;
+ property public static final androidx.compose.animation.core.Easing EaseInQuart;
+ property public static final androidx.compose.animation.core.Easing EaseInQuint;
+ property public static final androidx.compose.animation.core.Easing EaseInSine;
+ property public static final androidx.compose.animation.core.Easing EaseOut;
+ property public static final androidx.compose.animation.core.Easing EaseOutBack;
+ property public static final androidx.compose.animation.core.Easing EaseOutBounce;
+ property public static final androidx.compose.animation.core.Easing EaseOutCirc;
+ property public static final androidx.compose.animation.core.Easing EaseOutCubic;
+ property public static final androidx.compose.animation.core.Easing EaseOutElastic;
+ property public static final androidx.compose.animation.core.Easing EaseOutExpo;
+ property public static final androidx.compose.animation.core.Easing EaseOutQuad;
+ property public static final androidx.compose.animation.core.Easing EaseOutQuart;
+ property public static final androidx.compose.animation.core.Easing EaseOutQuint;
+ property public static final androidx.compose.animation.core.Easing EaseOutSine;
}
public final class EasingKt {
diff --git a/compose/animation/animation-core/api/public_plus_experimental_1.2.0-beta04.txt b/compose/animation/animation-core/api/public_plus_experimental_1.2.0-beta04.txt
index 21ed6fc..bd32547 100644
--- a/compose/animation/animation-core/api/public_plus_experimental_1.2.0-beta04.txt
+++ b/compose/animation/animation-core/api/public_plus_experimental_1.2.0-beta04.txt
@@ -244,74 +244,74 @@
}
public final class EasingFunctionsKt {
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEase();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseIn();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInBack();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInBounce();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInCirc();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInCubic();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInElastic();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInExpo();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOut();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOutBack();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOutBounce();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOutCirc();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOutCubic();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOutElastic();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOutExpo();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOutQuad();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOutQuart();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOutQuint();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInOutSine();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInQuad();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInQuart();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInQuint();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseInSine();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOut();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOutBack();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOutBounce();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOutCirc();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOutCubic();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOutElastic();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOutExpo();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOutQuad();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOutQuart();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOutQuint();
- method @androidx.compose.animation.core.ExperimentalEasingApi public static androidx.compose.animation.core.Easing getEaseOutSine();
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing Ease;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseIn;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInBack;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInBounce;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInCirc;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInCubic;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInElastic;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInExpo;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOut;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOutBack;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOutBounce;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOutCirc;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOutCubic;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOutElastic;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOutExpo;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOutQuad;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOutQuart;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOutQuint;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInOutSine;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInQuad;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInQuart;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInQuint;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseInSine;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOut;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOutBack;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOutBounce;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOutCirc;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOutCubic;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOutElastic;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOutExpo;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOutQuad;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOutQuart;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOutQuint;
- property @androidx.compose.animation.core.ExperimentalEasingApi public static final androidx.compose.animation.core.Easing EaseOutSine;
+ method public static androidx.compose.animation.core.Easing getEase();
+ method public static androidx.compose.animation.core.Easing getEaseIn();
+ method public static androidx.compose.animation.core.Easing getEaseInBack();
+ method public static androidx.compose.animation.core.Easing getEaseInBounce();
+ method public static androidx.compose.animation.core.Easing getEaseInCirc();
+ method public static androidx.compose.animation.core.Easing getEaseInCubic();
+ method public static androidx.compose.animation.core.Easing getEaseInElastic();
+ method public static androidx.compose.animation.core.Easing getEaseInExpo();
+ method public static androidx.compose.animation.core.Easing getEaseInOut();
+ method public static androidx.compose.animation.core.Easing getEaseInOutBack();
+ method public static androidx.compose.animation.core.Easing getEaseInOutBounce();
+ method public static androidx.compose.animation.core.Easing getEaseInOutCirc();
+ method public static androidx.compose.animation.core.Easing getEaseInOutCubic();
+ method public static androidx.compose.animation.core.Easing getEaseInOutElastic();
+ method public static androidx.compose.animation.core.Easing getEaseInOutExpo();
+ method public static androidx.compose.animation.core.Easing getEaseInOutQuad();
+ method public static androidx.compose.animation.core.Easing getEaseInOutQuart();
+ method public static androidx.compose.animation.core.Easing getEaseInOutQuint();
+ method public static androidx.compose.animation.core.Easing getEaseInOutSine();
+ method public static androidx.compose.animation.core.Easing getEaseInQuad();
+ method public static androidx.compose.animation.core.Easing getEaseInQuart();
+ method public static androidx.compose.animation.core.Easing getEaseInQuint();
+ method public static androidx.compose.animation.core.Easing getEaseInSine();
+ method public static androidx.compose.animation.core.Easing getEaseOut();
+ method public static androidx.compose.animation.core.Easing getEaseOutBack();
+ method public static androidx.compose.animation.core.Easing getEaseOutBounce();
+ method public static androidx.compose.animation.core.Easing getEaseOutCirc();
+ method public static androidx.compose.animation.core.Easing getEaseOutCubic();
+ method public static androidx.compose.animation.core.Easing getEaseOutElastic();
+ method public static androidx.compose.animation.core.Easing getEaseOutExpo();
+ method public static androidx.compose.animation.core.Easing getEaseOutQuad();
+ method public static androidx.compose.animation.core.Easing getEaseOutQuart();
+ method public static androidx.compose.animation.core.Easing getEaseOutQuint();
+ method public static androidx.compose.animation.core.Easing getEaseOutSine();
+ property public static final androidx.compose.animation.core.Easing Ease;
+ property public static final androidx.compose.animation.core.Easing EaseIn;
+ property public static final androidx.compose.animation.core.Easing EaseInBack;
+ property public static final androidx.compose.animation.core.Easing EaseInBounce;
+ property public static final androidx.compose.animation.core.Easing EaseInCirc;
+ property public static final androidx.compose.animation.core.Easing EaseInCubic;
+ property public static final androidx.compose.animation.core.Easing EaseInElastic;
+ property public static final androidx.compose.animation.core.Easing EaseInExpo;
+ property public static final androidx.compose.animation.core.Easing EaseInOut;
+ property public static final androidx.compose.animation.core.Easing EaseInOutBack;
+ property public static final androidx.compose.animation.core.Easing EaseInOutBounce;
+ property public static final androidx.compose.animation.core.Easing EaseInOutCirc;
+ property public static final androidx.compose.animation.core.Easing EaseInOutCubic;
+ property public static final androidx.compose.animation.core.Easing EaseInOutElastic;
+ property public static final androidx.compose.animation.core.Easing EaseInOutExpo;
+ property public static final androidx.compose.animation.core.Easing EaseInOutQuad;
+ property public static final androidx.compose.animation.core.Easing EaseInOutQuart;
+ property public static final androidx.compose.animation.core.Easing EaseInOutQuint;
+ property public static final androidx.compose.animation.core.Easing EaseInOutSine;
+ property public static final androidx.compose.animation.core.Easing EaseInQuad;
+ property public static final androidx.compose.animation.core.Easing EaseInQuart;
+ property public static final androidx.compose.animation.core.Easing EaseInQuint;
+ property public static final androidx.compose.animation.core.Easing EaseInSine;
+ property public static final androidx.compose.animation.core.Easing EaseOut;
+ property public static final androidx.compose.animation.core.Easing EaseOutBack;
+ property public static final androidx.compose.animation.core.Easing EaseOutBounce;
+ property public static final androidx.compose.animation.core.Easing EaseOutCirc;
+ property public static final androidx.compose.animation.core.Easing EaseOutCubic;
+ property public static final androidx.compose.animation.core.Easing EaseOutElastic;
+ property public static final androidx.compose.animation.core.Easing EaseOutExpo;
+ property public static final androidx.compose.animation.core.Easing EaseOutQuad;
+ property public static final androidx.compose.animation.core.Easing EaseOutQuart;
+ property public static final androidx.compose.animation.core.Easing EaseOutQuint;
+ property public static final androidx.compose.animation.core.Easing EaseOutSine;
}
public final class EasingKt {
@@ -325,9 +325,6 @@
property public static final androidx.compose.animation.core.Easing LinearOutSlowInEasing;
}
- @kotlin.RequiresOptIn(message="This is an experimental API for Easing curves. It may change in the future.") @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget.CLASS, kotlin.annotation.AnnotationTarget.FUNCTION, kotlin.annotation.AnnotationTarget.PROPERTY, kotlin.annotation.AnnotationTarget.FIELD, kotlin.annotation.AnnotationTarget.PROPERTY_GETTER}) public @interface ExperimentalEasingApi {
- }
-
@kotlin.RequiresOptIn(message="This is an experimental animation API for Transition. It may change in the future.") public @interface ExperimentalTransitionApi {
}
diff --git a/compose/animation/animation-core/api/restricted_1.2.0-beta04.txt b/compose/animation/animation-core/api/restricted_1.2.0-beta04.txt
index 96c8c71..45acb2d 100644
--- a/compose/animation/animation-core/api/restricted_1.2.0-beta04.txt
+++ b/compose/animation/animation-core/api/restricted_1.2.0-beta04.txt
@@ -244,6 +244,74 @@
}
public final class EasingFunctionsKt {
+ method public static androidx.compose.animation.core.Easing getEase();
+ method public static androidx.compose.animation.core.Easing getEaseIn();
+ method public static androidx.compose.animation.core.Easing getEaseInBack();
+ method public static androidx.compose.animation.core.Easing getEaseInBounce();
+ method public static androidx.compose.animation.core.Easing getEaseInCirc();
+ method public static androidx.compose.animation.core.Easing getEaseInCubic();
+ method public static androidx.compose.animation.core.Easing getEaseInElastic();
+ method public static androidx.compose.animation.core.Easing getEaseInExpo();
+ method public static androidx.compose.animation.core.Easing getEaseInOut();
+ method public static androidx.compose.animation.core.Easing getEaseInOutBack();
+ method public static androidx.compose.animation.core.Easing getEaseInOutBounce();
+ method public static androidx.compose.animation.core.Easing getEaseInOutCirc();
+ method public static androidx.compose.animation.core.Easing getEaseInOutCubic();
+ method public static androidx.compose.animation.core.Easing getEaseInOutElastic();
+ method public static androidx.compose.animation.core.Easing getEaseInOutExpo();
+ method public static androidx.compose.animation.core.Easing getEaseInOutQuad();
+ method public static androidx.compose.animation.core.Easing getEaseInOutQuart();
+ method public static androidx.compose.animation.core.Easing getEaseInOutQuint();
+ method public static androidx.compose.animation.core.Easing getEaseInOutSine();
+ method public static androidx.compose.animation.core.Easing getEaseInQuad();
+ method public static androidx.compose.animation.core.Easing getEaseInQuart();
+ method public static androidx.compose.animation.core.Easing getEaseInQuint();
+ method public static androidx.compose.animation.core.Easing getEaseInSine();
+ method public static androidx.compose.animation.core.Easing getEaseOut();
+ method public static androidx.compose.animation.core.Easing getEaseOutBack();
+ method public static androidx.compose.animation.core.Easing getEaseOutBounce();
+ method public static androidx.compose.animation.core.Easing getEaseOutCirc();
+ method public static androidx.compose.animation.core.Easing getEaseOutCubic();
+ method public static androidx.compose.animation.core.Easing getEaseOutElastic();
+ method public static androidx.compose.animation.core.Easing getEaseOutExpo();
+ method public static androidx.compose.animation.core.Easing getEaseOutQuad();
+ method public static androidx.compose.animation.core.Easing getEaseOutQuart();
+ method public static androidx.compose.animation.core.Easing getEaseOutQuint();
+ method public static androidx.compose.animation.core.Easing getEaseOutSine();
+ property public static final androidx.compose.animation.core.Easing Ease;
+ property public static final androidx.compose.animation.core.Easing EaseIn;
+ property public static final androidx.compose.animation.core.Easing EaseInBack;
+ property public static final androidx.compose.animation.core.Easing EaseInBounce;
+ property public static final androidx.compose.animation.core.Easing EaseInCirc;
+ property public static final androidx.compose.animation.core.Easing EaseInCubic;
+ property public static final androidx.compose.animation.core.Easing EaseInElastic;
+ property public static final androidx.compose.animation.core.Easing EaseInExpo;
+ property public static final androidx.compose.animation.core.Easing EaseInOut;
+ property public static final androidx.compose.animation.core.Easing EaseInOutBack;
+ property public static final androidx.compose.animation.core.Easing EaseInOutBounce;
+ property public static final androidx.compose.animation.core.Easing EaseInOutCirc;
+ property public static final androidx.compose.animation.core.Easing EaseInOutCubic;
+ property public static final androidx.compose.animation.core.Easing EaseInOutElastic;
+ property public static final androidx.compose.animation.core.Easing EaseInOutExpo;
+ property public static final androidx.compose.animation.core.Easing EaseInOutQuad;
+ property public static final androidx.compose.animation.core.Easing EaseInOutQuart;
+ property public static final androidx.compose.animation.core.Easing EaseInOutQuint;
+ property public static final androidx.compose.animation.core.Easing EaseInOutSine;
+ property public static final androidx.compose.animation.core.Easing EaseInQuad;
+ property public static final androidx.compose.animation.core.Easing EaseInQuart;
+ property public static final androidx.compose.animation.core.Easing EaseInQuint;
+ property public static final androidx.compose.animation.core.Easing EaseInSine;
+ property public static final androidx.compose.animation.core.Easing EaseOut;
+ property public static final androidx.compose.animation.core.Easing EaseOutBack;
+ property public static final androidx.compose.animation.core.Easing EaseOutBounce;
+ property public static final androidx.compose.animation.core.Easing EaseOutCirc;
+ property public static final androidx.compose.animation.core.Easing EaseOutCubic;
+ property public static final androidx.compose.animation.core.Easing EaseOutElastic;
+ property public static final androidx.compose.animation.core.Easing EaseOutExpo;
+ property public static final androidx.compose.animation.core.Easing EaseOutQuad;
+ property public static final androidx.compose.animation.core.Easing EaseOutQuart;
+ property public static final androidx.compose.animation.core.Easing EaseOutQuint;
+ property public static final androidx.compose.animation.core.Easing EaseOutSine;
}
public final class EasingKt {
diff --git a/compose/animation/animation/api/1.2.0-beta04.txt b/compose/animation/animation/api/1.2.0-beta04.txt
index 4f8ad04..ffba6d1 100644
--- a/compose/animation/animation/api/1.2.0-beta04.txt
+++ b/compose/animation/animation/api/1.2.0-beta04.txt
@@ -17,7 +17,7 @@
method @androidx.compose.runtime.Composable public static void AnimatedVisibility(androidx.compose.foundation.layout.ColumnScope, androidx.compose.animation.core.MutableTransitionState<java.lang.Boolean> visibleState, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.animation.EnterTransition enter, optional androidx.compose.animation.ExitTransition exit, optional String label, kotlin.jvm.functions.Function1<? super androidx.compose.animation.AnimatedVisibilityScope,kotlin.Unit> content);
}
- public interface AnimatedVisibilityScope {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface AnimatedVisibilityScope {
}
public final class AnimationModifierKt {
diff --git a/compose/animation/animation/api/public_plus_experimental_1.2.0-beta04.txt b/compose/animation/animation/api/public_plus_experimental_1.2.0-beta04.txt
index e7765d0..f261db5 100644
--- a/compose/animation/animation/api/public_plus_experimental_1.2.0-beta04.txt
+++ b/compose/animation/animation/api/public_plus_experimental_1.2.0-beta04.txt
@@ -52,7 +52,7 @@
method @Deprecated @androidx.compose.animation.ExperimentalAnimationApi @androidx.compose.runtime.Composable public static void AnimatedVisibility(boolean visible, optional androidx.compose.ui.Modifier modifier, androidx.compose.animation.EnterTransition enter, androidx.compose.animation.ExitTransition exit, boolean initiallyVisible, kotlin.jvm.functions.Function0<kotlin.Unit> content);
}
- public interface AnimatedVisibilityScope {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface AnimatedVisibilityScope {
method @androidx.compose.animation.ExperimentalAnimationApi public default androidx.compose.ui.Modifier animateEnterExit(androidx.compose.ui.Modifier, optional androidx.compose.animation.EnterTransition enter, optional androidx.compose.animation.ExitTransition exit, optional String label);
method @androidx.compose.animation.ExperimentalAnimationApi public androidx.compose.animation.core.Transition<androidx.compose.animation.EnterExitState> getTransition();
property @androidx.compose.animation.ExperimentalAnimationApi public abstract androidx.compose.animation.core.Transition<androidx.compose.animation.EnterExitState> transition;
diff --git a/compose/animation/animation/api/restricted_1.2.0-beta04.txt b/compose/animation/animation/api/restricted_1.2.0-beta04.txt
index 4f8ad04..ffba6d1 100644
--- a/compose/animation/animation/api/restricted_1.2.0-beta04.txt
+++ b/compose/animation/animation/api/restricted_1.2.0-beta04.txt
@@ -17,7 +17,7 @@
method @androidx.compose.runtime.Composable public static void AnimatedVisibility(androidx.compose.foundation.layout.ColumnScope, androidx.compose.animation.core.MutableTransitionState<java.lang.Boolean> visibleState, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.animation.EnterTransition enter, optional androidx.compose.animation.ExitTransition exit, optional String label, kotlin.jvm.functions.Function1<? super androidx.compose.animation.AnimatedVisibilityScope,kotlin.Unit> content);
}
- public interface AnimatedVisibilityScope {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface AnimatedVisibilityScope {
}
public final class AnimationModifierKt {
diff --git a/compose/foundation/foundation-layout/api/1.2.0-beta04.txt b/compose/foundation/foundation-layout/api/1.2.0-beta04.txt
index c3a6c71..062ce706 100644
--- a/compose/foundation/foundation-layout/api/1.2.0-beta04.txt
+++ b/compose/foundation/foundation-layout/api/1.2.0-beta04.txt
@@ -104,7 +104,7 @@
method @androidx.compose.runtime.Composable public static inline void Column(optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.Arrangement.Vertical verticalArrangement, optional androidx.compose.ui.Alignment.Horizontal horizontalAlignment, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.ColumnScope,kotlin.Unit> content);
}
- @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable public interface ColumnScope {
+ @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable @kotlin.jvm.JvmDefaultWithCompatibility public interface ColumnScope {
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier align(androidx.compose.ui.Modifier, androidx.compose.ui.Alignment.Horizontal alignment);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, androidx.compose.ui.layout.VerticalAlignmentLine alignmentLine);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Measured,java.lang.Integer> alignmentLineBlock);
@@ -168,7 +168,7 @@
method @androidx.compose.runtime.Composable public static inline void Row(optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.Arrangement.Horizontal horizontalArrangement, optional androidx.compose.ui.Alignment.Vertical verticalAlignment, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.RowScope,kotlin.Unit> content);
}
- @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable public interface RowScope {
+ @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable @kotlin.jvm.JvmDefaultWithCompatibility public interface RowScope {
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier align(androidx.compose.ui.Modifier, androidx.compose.ui.Alignment.Vertical alignment);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, androidx.compose.ui.layout.HorizontalAlignmentLine alignmentLine);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Measured,java.lang.Integer> alignmentLineBlock);
diff --git a/compose/foundation/foundation-layout/api/public_plus_experimental_1.2.0-beta04.txt b/compose/foundation/foundation-layout/api/public_plus_experimental_1.2.0-beta04.txt
index 09e3e81..02bceb2 100644
--- a/compose/foundation/foundation-layout/api/public_plus_experimental_1.2.0-beta04.txt
+++ b/compose/foundation/foundation-layout/api/public_plus_experimental_1.2.0-beta04.txt
@@ -104,7 +104,7 @@
method @androidx.compose.runtime.Composable public static inline void Column(optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.Arrangement.Vertical verticalArrangement, optional androidx.compose.ui.Alignment.Horizontal horizontalAlignment, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.ColumnScope,kotlin.Unit> content);
}
- @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable public interface ColumnScope {
+ @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable @kotlin.jvm.JvmDefaultWithCompatibility public interface ColumnScope {
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier align(androidx.compose.ui.Modifier, androidx.compose.ui.Alignment.Horizontal alignment);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, androidx.compose.ui.layout.VerticalAlignmentLine alignmentLine);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Measured,java.lang.Integer> alignmentLineBlock);
@@ -171,7 +171,7 @@
method @androidx.compose.runtime.Composable public static inline void Row(optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.Arrangement.Horizontal horizontalArrangement, optional androidx.compose.ui.Alignment.Vertical verticalAlignment, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.RowScope,kotlin.Unit> content);
}
- @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable public interface RowScope {
+ @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable @kotlin.jvm.JvmDefaultWithCompatibility public interface RowScope {
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier align(androidx.compose.ui.Modifier, androidx.compose.ui.Alignment.Vertical alignment);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, androidx.compose.ui.layout.HorizontalAlignmentLine alignmentLine);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Measured,java.lang.Integer> alignmentLineBlock);
diff --git a/compose/foundation/foundation-layout/api/restricted_1.2.0-beta04.txt b/compose/foundation/foundation-layout/api/restricted_1.2.0-beta04.txt
index f2fc189..577d83dc 100644
--- a/compose/foundation/foundation-layout/api/restricted_1.2.0-beta04.txt
+++ b/compose/foundation/foundation-layout/api/restricted_1.2.0-beta04.txt
@@ -107,7 +107,7 @@
field @kotlin.PublishedApi internal static final androidx.compose.ui.layout.MeasurePolicy DefaultColumnMeasurePolicy;
}
- @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable public interface ColumnScope {
+ @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable @kotlin.jvm.JvmDefaultWithCompatibility public interface ColumnScope {
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier align(androidx.compose.ui.Modifier, androidx.compose.ui.Alignment.Horizontal alignment);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, androidx.compose.ui.layout.VerticalAlignmentLine alignmentLine);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Measured,java.lang.Integer> alignmentLineBlock);
@@ -173,7 +173,7 @@
field @kotlin.PublishedApi internal static final androidx.compose.ui.layout.MeasurePolicy DefaultRowMeasurePolicy;
}
- @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable public interface RowScope {
+ @androidx.compose.foundation.layout.LayoutScopeMarker @androidx.compose.runtime.Immutable @kotlin.jvm.JvmDefaultWithCompatibility public interface RowScope {
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier align(androidx.compose.ui.Modifier, androidx.compose.ui.Alignment.Vertical alignment);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, androidx.compose.ui.layout.HorizontalAlignmentLine alignmentLine);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Measured,java.lang.Integer> alignmentLineBlock);
diff --git a/compose/foundation/foundation-layout/build.gradle b/compose/foundation/foundation-layout/build.gradle
index acf2ae2..123ef41 100644
--- a/compose/foundation/foundation-layout/build.gradle
+++ b/compose/foundation/foundation-layout/build.gradle
@@ -36,10 +36,10 @@
*/
api("androidx.annotation:annotation:1.1.0")
- api(project(":compose:ui:ui"))
+ api("androidx.compose.ui:ui:1.2.0-rc01")
api("androidx.compose.ui:ui-unit:1.1.1")
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
implementation("androidx.compose.ui:ui-util:1.0.0")
implementation("androidx.core:core:1.7.0")
implementation("androidx.compose.animation:animation-core:1.1.1")
diff --git a/compose/foundation/foundation-layout/samples/build.gradle b/compose/foundation/foundation-layout/samples/build.gradle
index b61e019..905cda5 100644
--- a/compose/foundation/foundation-layout/samples/build.gradle
+++ b/compose/foundation/foundation-layout/samples/build.gradle
@@ -32,7 +32,7 @@
implementation(project(":compose:foundation:foundation"))
implementation(project(":compose:foundation:foundation-layout"))
implementation("androidx.compose.material:material:1.0.0")
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
implementation("androidx.compose.ui:ui:1.0.0")
implementation("androidx.compose.ui:ui-text:1.0.0")
implementation("androidx.core:core-ktx:1.7.0")
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxWithConstraintsTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxWithConstraintsTest.kt
index 243fd53..a4c46cf 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxWithConstraintsTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxWithConstraintsTest.kt
@@ -683,6 +683,8 @@
assertTrue(latch.await(1, TimeUnit.SECONDS))
}
+ // waitAndScreenShot() requires API level 26
+ @RequiresApi(Build.VERSION_CODES.O)
private fun takeScreenShot(size: Int): Bitmap {
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
val bitmap = activityTestRule.waitAndScreenShot()
diff --git a/compose/foundation/foundation/api/1.2.0-beta04.txt b/compose/foundation/foundation/api/1.2.0-beta04.txt
index fd0ed40..eb9609b 100644
--- a/compose/foundation/foundation/api/1.2.0-beta04.txt
+++ b/compose/foundation/foundation/api/1.2.0-beta04.txt
@@ -188,7 +188,7 @@
method @androidx.compose.runtime.Composable public static androidx.compose.foundation.gestures.DraggableState rememberDraggableState(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> onDelta);
}
- public interface DraggableState {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface DraggableState {
method public void dispatchRawDelta(float delta);
method public suspend Object? drag(optional androidx.compose.foundation.MutatePriority dragPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.DragScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
}
@@ -234,7 +234,7 @@
method public static androidx.compose.ui.Modifier scrollable(androidx.compose.ui.Modifier, androidx.compose.foundation.gestures.ScrollableState state, androidx.compose.foundation.gestures.Orientation orientation, optional boolean enabled, optional boolean reverseDirection, optional androidx.compose.foundation.gestures.FlingBehavior? flingBehavior, optional androidx.compose.foundation.interaction.MutableInteractionSource? interactionSource);
}
- public interface ScrollableState {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ScrollableState {
method public float dispatchRawDelta(float delta);
method public boolean isScrollInProgress();
method public suspend Object? scroll(optional androidx.compose.foundation.MutatePriority scrollPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.ScrollScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
@@ -261,7 +261,7 @@
method public static suspend Object? detectTransformGestures(androidx.compose.ui.input.pointer.PointerInputScope, optional boolean panZoomLock, kotlin.jvm.functions.Function4<? super androidx.compose.ui.geometry.Offset,? super androidx.compose.ui.geometry.Offset,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> onGesture, kotlin.coroutines.Continuation<? super kotlin.Unit>);
}
- public interface TransformScope {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface TransformScope {
method public void transformBy(optional float zoomChange, optional long panChange, optional float rotationChange);
}
@@ -269,7 +269,7 @@
method public static androidx.compose.ui.Modifier transformable(androidx.compose.ui.Modifier, androidx.compose.foundation.gestures.TransformableState state, optional boolean lockRotationOnZoomPan, optional boolean enabled);
}
- public interface TransformableState {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface TransformableState {
method public boolean isTransformInProgress();
method public suspend Object? transform(optional androidx.compose.foundation.MutatePriority transformPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.TransformScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
property public abstract boolean isTransformInProgress;
@@ -412,7 +412,7 @@
method @Deprecated public static inline <T> void itemsIndexed(androidx.compose.foundation.lazy.LazyListScope, T![] items, optional kotlin.jvm.functions.Function2<? super java.lang.Integer,? super T,?>? key, kotlin.jvm.functions.Function3<? super androidx.compose.foundation.lazy.LazyItemScope,? super java.lang.Integer,? super T,? extends kotlin.Unit> itemContent);
}
- @androidx.compose.foundation.lazy.LazyScopeMarker @androidx.compose.runtime.Stable public interface LazyItemScope {
+ @androidx.compose.foundation.lazy.LazyScopeMarker @androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyItemScope {
method public androidx.compose.ui.Modifier fillParentMaxHeight(androidx.compose.ui.Modifier, optional float fraction);
method public androidx.compose.ui.Modifier fillParentMaxSize(androidx.compose.ui.Modifier, optional float fraction);
method public androidx.compose.ui.Modifier fillParentMaxWidth(androidx.compose.ui.Modifier, optional float fraction);
@@ -441,7 +441,7 @@
public final class LazyListKt {
}
- public interface LazyListLayoutInfo {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyListLayoutInfo {
method public default int getAfterContentPadding();
method public default int getBeforeContentPadding();
method public default androidx.compose.foundation.gestures.Orientation getOrientation();
@@ -468,7 +468,7 @@
public final class LazyListPinningModifierKt {
}
- @androidx.compose.foundation.lazy.LazyScopeMarker public interface LazyListScope {
+ @androidx.compose.foundation.lazy.LazyScopeMarker @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyListScope {
method public default void item(optional Object? key, optional Object? contentType, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.lazy.LazyItemScope,kotlin.Unit> content);
method @Deprecated public void item(optional Object? key, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.lazy.LazyItemScope,? extends kotlin.Unit> content);
method public default void items(int count, optional kotlin.jvm.functions.Function1<? super java.lang.Integer,?>? key, optional kotlin.jvm.functions.Function1<? super java.lang.Integer,?> contentType, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.lazy.LazyItemScope,? super java.lang.Integer,kotlin.Unit> itemContent);
diff --git a/compose/foundation/foundation/api/public_plus_experimental_1.2.0-beta04.txt b/compose/foundation/foundation/api/public_plus_experimental_1.2.0-beta04.txt
index 128d189..405623a 100644
--- a/compose/foundation/foundation/api/public_plus_experimental_1.2.0-beta04.txt
+++ b/compose/foundation/foundation/api/public_plus_experimental_1.2.0-beta04.txt
@@ -241,7 +241,7 @@
method @androidx.compose.runtime.Composable public static androidx.compose.foundation.gestures.DraggableState rememberDraggableState(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> onDelta);
}
- public interface DraggableState {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface DraggableState {
method public void dispatchRawDelta(float delta);
method public suspend Object? drag(optional androidx.compose.foundation.MutatePriority dragPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.DragScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
}
@@ -289,7 +289,7 @@
method @androidx.compose.foundation.ExperimentalFoundationApi public static androidx.compose.ui.Modifier scrollable(androidx.compose.ui.Modifier, androidx.compose.foundation.gestures.ScrollableState state, androidx.compose.foundation.gestures.Orientation orientation, androidx.compose.foundation.OverscrollEffect? overscrollEffect, optional boolean enabled, optional boolean reverseDirection, optional androidx.compose.foundation.gestures.FlingBehavior? flingBehavior, optional androidx.compose.foundation.interaction.MutableInteractionSource? interactionSource);
}
- public interface ScrollableState {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ScrollableState {
method public float dispatchRawDelta(float delta);
method public boolean isScrollInProgress();
method public suspend Object? scroll(optional androidx.compose.foundation.MutatePriority scrollPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.ScrollScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
@@ -316,7 +316,7 @@
method public static suspend Object? detectTransformGestures(androidx.compose.ui.input.pointer.PointerInputScope, optional boolean panZoomLock, kotlin.jvm.functions.Function4<? super androidx.compose.ui.geometry.Offset,? super androidx.compose.ui.geometry.Offset,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> onGesture, kotlin.coroutines.Continuation<? super kotlin.Unit>);
}
- public interface TransformScope {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface TransformScope {
method public void transformBy(optional float zoomChange, optional long panChange, optional float rotationChange);
}
@@ -324,7 +324,7 @@
method public static androidx.compose.ui.Modifier transformable(androidx.compose.ui.Modifier, androidx.compose.foundation.gestures.TransformableState state, optional boolean lockRotationOnZoomPan, optional boolean enabled);
}
- public interface TransformableState {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface TransformableState {
method public boolean isTransformInProgress();
method public suspend Object? transform(optional androidx.compose.foundation.MutatePriority transformPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.TransformScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
property public abstract boolean isTransformInProgress;
@@ -467,7 +467,7 @@
method @Deprecated public static inline <T> void itemsIndexed(androidx.compose.foundation.lazy.LazyListScope, T![] items, optional kotlin.jvm.functions.Function2<? super java.lang.Integer,? super T,?>? key, kotlin.jvm.functions.Function3<? super androidx.compose.foundation.lazy.LazyItemScope,? super java.lang.Integer,? super T,? extends kotlin.Unit> itemContent);
}
- @androidx.compose.foundation.lazy.LazyScopeMarker @androidx.compose.runtime.Stable public interface LazyItemScope {
+ @androidx.compose.foundation.lazy.LazyScopeMarker @androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyItemScope {
method @androidx.compose.foundation.ExperimentalFoundationApi public androidx.compose.ui.Modifier animateItemPlacement(androidx.compose.ui.Modifier, optional androidx.compose.animation.core.FiniteAnimationSpec<androidx.compose.ui.unit.IntOffset> animationSpec);
method public androidx.compose.ui.Modifier fillParentMaxHeight(androidx.compose.ui.Modifier, optional float fraction);
method public androidx.compose.ui.Modifier fillParentMaxSize(androidx.compose.ui.Modifier, optional float fraction);
@@ -497,7 +497,7 @@
public final class LazyListKt {
}
- public interface LazyListLayoutInfo {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyListLayoutInfo {
method public default int getAfterContentPadding();
method public default int getBeforeContentPadding();
method public default androidx.compose.foundation.gestures.Orientation getOrientation();
@@ -524,7 +524,7 @@
public final class LazyListPinningModifierKt {
}
- @androidx.compose.foundation.lazy.LazyScopeMarker public interface LazyListScope {
+ @androidx.compose.foundation.lazy.LazyScopeMarker @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyListScope {
method public default void item(optional Object? key, optional Object? contentType, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.lazy.LazyItemScope,kotlin.Unit> content);
method @Deprecated public void item(optional Object? key, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.lazy.LazyItemScope,? extends kotlin.Unit> content);
method public default void items(int count, optional kotlin.jvm.functions.Function1<? super java.lang.Integer,?>? key, optional kotlin.jvm.functions.Function1<? super java.lang.Integer,?> contentType, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.lazy.LazyItemScope,? super java.lang.Integer,kotlin.Unit> itemContent);
diff --git a/compose/foundation/foundation/api/restricted_1.2.0-beta04.txt b/compose/foundation/foundation/api/restricted_1.2.0-beta04.txt
index fd0ed40..eb9609b 100644
--- a/compose/foundation/foundation/api/restricted_1.2.0-beta04.txt
+++ b/compose/foundation/foundation/api/restricted_1.2.0-beta04.txt
@@ -188,7 +188,7 @@
method @androidx.compose.runtime.Composable public static androidx.compose.foundation.gestures.DraggableState rememberDraggableState(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> onDelta);
}
- public interface DraggableState {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface DraggableState {
method public void dispatchRawDelta(float delta);
method public suspend Object? drag(optional androidx.compose.foundation.MutatePriority dragPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.DragScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
}
@@ -234,7 +234,7 @@
method public static androidx.compose.ui.Modifier scrollable(androidx.compose.ui.Modifier, androidx.compose.foundation.gestures.ScrollableState state, androidx.compose.foundation.gestures.Orientation orientation, optional boolean enabled, optional boolean reverseDirection, optional androidx.compose.foundation.gestures.FlingBehavior? flingBehavior, optional androidx.compose.foundation.interaction.MutableInteractionSource? interactionSource);
}
- public interface ScrollableState {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ScrollableState {
method public float dispatchRawDelta(float delta);
method public boolean isScrollInProgress();
method public suspend Object? scroll(optional androidx.compose.foundation.MutatePriority scrollPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.ScrollScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
@@ -261,7 +261,7 @@
method public static suspend Object? detectTransformGestures(androidx.compose.ui.input.pointer.PointerInputScope, optional boolean panZoomLock, kotlin.jvm.functions.Function4<? super androidx.compose.ui.geometry.Offset,? super androidx.compose.ui.geometry.Offset,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> onGesture, kotlin.coroutines.Continuation<? super kotlin.Unit>);
}
- public interface TransformScope {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface TransformScope {
method public void transformBy(optional float zoomChange, optional long panChange, optional float rotationChange);
}
@@ -269,7 +269,7 @@
method public static androidx.compose.ui.Modifier transformable(androidx.compose.ui.Modifier, androidx.compose.foundation.gestures.TransformableState state, optional boolean lockRotationOnZoomPan, optional boolean enabled);
}
- public interface TransformableState {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface TransformableState {
method public boolean isTransformInProgress();
method public suspend Object? transform(optional androidx.compose.foundation.MutatePriority transformPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.TransformScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
property public abstract boolean isTransformInProgress;
@@ -412,7 +412,7 @@
method @Deprecated public static inline <T> void itemsIndexed(androidx.compose.foundation.lazy.LazyListScope, T![] items, optional kotlin.jvm.functions.Function2<? super java.lang.Integer,? super T,?>? key, kotlin.jvm.functions.Function3<? super androidx.compose.foundation.lazy.LazyItemScope,? super java.lang.Integer,? super T,? extends kotlin.Unit> itemContent);
}
- @androidx.compose.foundation.lazy.LazyScopeMarker @androidx.compose.runtime.Stable public interface LazyItemScope {
+ @androidx.compose.foundation.lazy.LazyScopeMarker @androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyItemScope {
method public androidx.compose.ui.Modifier fillParentMaxHeight(androidx.compose.ui.Modifier, optional float fraction);
method public androidx.compose.ui.Modifier fillParentMaxSize(androidx.compose.ui.Modifier, optional float fraction);
method public androidx.compose.ui.Modifier fillParentMaxWidth(androidx.compose.ui.Modifier, optional float fraction);
@@ -441,7 +441,7 @@
public final class LazyListKt {
}
- public interface LazyListLayoutInfo {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyListLayoutInfo {
method public default int getAfterContentPadding();
method public default int getBeforeContentPadding();
method public default androidx.compose.foundation.gestures.Orientation getOrientation();
@@ -468,7 +468,7 @@
public final class LazyListPinningModifierKt {
}
- @androidx.compose.foundation.lazy.LazyScopeMarker public interface LazyListScope {
+ @androidx.compose.foundation.lazy.LazyScopeMarker @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyListScope {
method public default void item(optional Object? key, optional Object? contentType, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.lazy.LazyItemScope,kotlin.Unit> content);
method @Deprecated public void item(optional Object? key, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.lazy.LazyItemScope,? extends kotlin.Unit> content);
method public default void items(int count, optional kotlin.jvm.functions.Function1<? super java.lang.Integer,?>? key, optional kotlin.jvm.functions.Function1<? super java.lang.Integer,?> contentType, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.lazy.LazyItemScope,? super java.lang.Integer,kotlin.Unit> itemContent);
diff --git a/compose/foundation/foundation/build.gradle b/compose/foundation/foundation/build.gradle
index f2ef36b..6fa1923 100644
--- a/compose/foundation/foundation/build.gradle
+++ b/compose/foundation/foundation/build.gradle
@@ -37,8 +37,8 @@
*/
api("androidx.annotation:annotation:1.1.0")
api("androidx.compose.animation:animation:1.1.1")
- api(project(':compose:runtime:runtime'))
- api(project(":compose:ui:ui"))
+ api("androidx.compose.runtime:runtime:1.2.0-rc01")
+ api("androidx.compose.ui:ui:1.2.0-rc01")
implementation(libs.kotlinStdlibCommon)
implementation(project(":compose:foundation:foundation-layout"))
diff --git a/compose/foundation/foundation/samples/build.gradle b/compose/foundation/foundation/samples/build.gradle
index 25040a6..fa88856 100644
--- a/compose/foundation/foundation/samples/build.gradle
+++ b/compose/foundation/foundation/samples/build.gradle
@@ -34,7 +34,7 @@
implementation(project(":compose:foundation:foundation"))
implementation(project(":compose:foundation:foundation-layout"))
implementation("androidx.compose.material:material:1.0.0")
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
implementation("androidx.compose.ui:ui:1.0.0")
implementation("androidx.compose.ui:ui-text:1.0.0")
}
diff --git a/compose/material/material-icons-core/samples/build.gradle b/compose/material/material-icons-core/samples/build.gradle
index bae3717..ffaf157 100644
--- a/compose/material/material-icons-core/samples/build.gradle
+++ b/compose/material/material-icons-core/samples/build.gradle
@@ -33,7 +33,7 @@
implementation(project(":compose:material:material"))
implementation(project(":compose:material:material-icons-core"))
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
}
androidx {
diff --git a/compose/material/material/api/public_plus_experimental_current.txt b/compose/material/material/api/public_plus_experimental_current.txt
index ea72fbe..a673591 100644
--- a/compose/material/material/api/public_plus_experimental_current.txt
+++ b/compose/material/material/api/public_plus_experimental_current.txt
@@ -657,7 +657,7 @@
}
public final class SliderKt {
- method @androidx.compose.material.ExperimentalMaterialApi @androidx.compose.runtime.Composable public static void RangeSlider(kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> values, kotlin.jvm.functions.Function1<? super kotlin.ranges.ClosedFloatingPointRange<java.lang.Float>,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.material.SliderColors colors);
+ method @androidx.compose.material.ExperimentalMaterialApi @androidx.compose.runtime.Composable public static void RangeSlider(kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> value, kotlin.jvm.functions.Function1<? super kotlin.ranges.ClosedFloatingPointRange<java.lang.Float>,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.material.SliderColors colors);
method @androidx.compose.runtime.Composable public static void Slider(float value, kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional androidx.compose.material.SliderColors colors);
}
diff --git a/compose/material/material/build.gradle b/compose/material/material/build.gradle
index 97d445e..d0a021c 100644
--- a/compose/material/material/build.gradle
+++ b/compose/material/material/build.gradle
@@ -1,4 +1,4 @@
-/*
+/*./material/material/build.gradle
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,12 +34,12 @@
* corresponding block below
*/
api("androidx.compose.animation:animation-core:1.0.0")
- api(project(":compose:foundation:foundation"))
+ api("androidx.compose.foundation:foundation:1.2.0-rc01")
api(project(":compose:material:material-icons-core"))
api(project(":compose:material:material-ripple"))
- api(project(":compose:runtime:runtime"))
- api(project(":compose:ui:ui:"))
- api(project(":compose:ui:ui-text"))
+ api("androidx.compose.runtime:runtime:1.2.0-rc01")
+ api("androidx.compose.ui:ui:1.2.0-rc01")
+ api("androidx.compose.ui:ui-text:1.2.0-rc01")
implementation(libs.kotlinStdlibCommon)
implementation("androidx.compose.animation:animation:1.0.0")
diff --git a/compose/material/material/samples/build.gradle b/compose/material/material/samples/build.gradle
index 4aefe60..2b4db5e 100644
--- a/compose/material/material/samples/build.gradle
+++ b/compose/material/material/samples/build.gradle
@@ -35,7 +35,7 @@
implementation("androidx.compose.foundation:foundation:1.0.0")
implementation("androidx.compose.foundation:foundation-layout:1.0.0")
implementation(project(":compose:material:material"))
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
implementation("androidx.compose.ui:ui:1.0.0")
implementation("androidx.compose.ui:ui-text:1.0.0")
}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SliderSample.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SliderSample.kt
index e68c665..3232aba 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SliderSample.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SliderSample.kt
@@ -65,7 +65,7 @@
var sliderPosition by remember { mutableStateOf(0f..100f) }
Text(text = sliderPosition.toString())
RangeSlider(
- values = sliderPosition,
+ value = sliderPosition,
onValueChange = { sliderPosition = it },
valueRange = 0f..100f,
onValueChangeFinished = {
@@ -83,7 +83,7 @@
Text(text = sliderPosition.toString())
RangeSlider(
steps = 5,
- values = sliderPosition,
+ value = sliderPosition,
onValueChange = { sliderPosition = it },
valueRange = 0f..100f,
onValueChangeFinished = {
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderScreenshotTest.kt
index b282d58..db70aca 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderScreenshotTest.kt
@@ -231,7 +231,7 @@
Box(wrap.testTag(wrapperTestTag)) {
var position by remember { mutableStateOf(30f..70f) }
RangeSlider(
- values = position,
+ value = position,
valueRange = 0f..100f,
onValueChange = { position = it }, steps = 9,
colors = SliderDefaults.colors(
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderTest.kt
index d388ff5..8912f1c 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderTest.kt
@@ -657,7 +657,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -691,7 +691,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -729,7 +729,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -765,7 +765,7 @@
rule.setMaterialContent {
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -797,7 +797,7 @@
rule.setMaterialContent {
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it },
valueRange = 0f..rangeEnd.value
)
@@ -832,7 +832,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -870,7 +870,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -910,7 +910,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -946,7 +946,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -984,7 +984,7 @@
Row(Modifier.width(500.toDp())) {
Spacer(Modifier.requiredSize(100.toDp()))
RangeSlider(
- values = 0f..0.5f,
+ value = 0f..0.5f,
onValueChange = {},
modifier = Modifier.testTag(tag).weight(1f).onGloballyPositioned {
sliderBounds = it.boundsInParent()
@@ -1008,7 +1008,7 @@
rule.setMaterialContent {
RangeSlider(
- modifier = Modifier.testTag(tag), values = state.value,
+ modifier = Modifier.testTag(tag), value = state.value,
onValueChange = { state.value = it }
)
}
@@ -1061,7 +1061,7 @@
// Slider with [0,5,10,15,20] possible values
rule.setMaterialContent {
RangeSlider(
- modifier = Modifier.testTag(tag), values = state.value,
+ modifier = Modifier.testTag(tag), value = state.value,
steps = 3,
valueRange = 0f..20f,
onValueChange = { state.value = it },
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
index b982fc1..339aa65 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
@@ -262,12 +262,12 @@
*
* @sample androidx.compose.material.samples.StepRangeSliderSample
*
- * @param values current values of the RangeSlider. If either value is outside of [valueRange]
+ * @param value current values of the RangeSlider. If either value is outside of [valueRange]
* provided, it will be coerced to this range.
* @param onValueChange lambda in which values should be updated
* @param modifier modifiers for the Range Slider layout
* @param enabled whether or not component is enabled and can we interacted with or not
- * @param valueRange range of values that Range Slider values can take. Passed [values] will be
+ * @param valueRange range of values that Range Slider values can take. Passed [value] will be
* coerced to this range
* @param steps if greater than 0, specifies the amounts of discrete values, evenly distributed
* between across the whole value range. If 0, range slider will behave as a continuous slider and
@@ -281,7 +281,7 @@
@Composable
@ExperimentalMaterialApi
fun RangeSlider(
- values: ClosedFloatingPointRange<Float>,
+ value: ClosedFloatingPointRange<Float>,
onValueChange: (ClosedFloatingPointRange<Float>) -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
@@ -321,22 +321,22 @@
fun scaleToOffset(userValue: Float) =
scale(valueRange.start, valueRange.endInclusive, userValue, minPx, maxPx)
- val rawOffsetStart = remember { mutableStateOf(scaleToOffset(values.start)) }
- val rawOffsetEnd = remember { mutableStateOf(scaleToOffset(values.endInclusive)) }
+ val rawOffsetStart = remember { mutableStateOf(scaleToOffset(value.start)) }
+ val rawOffsetEnd = remember { mutableStateOf(scaleToOffset(value.endInclusive)) }
CorrectValueSideEffect(
::scaleToOffset,
valueRange,
minPx..maxPx,
rawOffsetStart,
- values.start
+ value.start
)
CorrectValueSideEffect(
::scaleToOffset,
valueRange,
minPx..maxPx,
rawOffsetEnd,
- values.endInclusive
+ value.endInclusive
)
val scope = rememberCoroutineScope()
@@ -367,13 +367,13 @@
val onDrag = rememberUpdatedState<(Boolean, Float) -> Unit> { isStart, offset ->
val offsetRange = if (isStart) {
rawOffsetStart.value = (rawOffsetStart.value + offset)
- rawOffsetEnd.value = scaleToOffset(values.endInclusive)
+ rawOffsetEnd.value = scaleToOffset(value.endInclusive)
val offsetEnd = rawOffsetEnd.value
val offsetStart = rawOffsetStart.value.coerceIn(minPx, offsetEnd)
offsetStart..offsetEnd
} else {
rawOffsetEnd.value = (rawOffsetEnd.value + offset)
- rawOffsetStart.value = scaleToOffset(values.start)
+ rawOffsetStart.value = scaleToOffset(value.start)
val offsetStart = rawOffsetStart.value
val offsetEnd = rawOffsetEnd.value.coerceIn(offsetStart, maxPx)
offsetStart..offsetEnd
@@ -396,8 +396,8 @@
)
// The positions of the thumbs are dependant on each other.
- val coercedStart = values.start.coerceIn(valueRange.start, values.endInclusive)
- val coercedEnd = values.endInclusive.coerceIn(values.start, valueRange.endInclusive)
+ val coercedStart = value.start.coerceIn(valueRange.start, value.endInclusive)
+ val coercedEnd = value.endInclusive.coerceIn(value.start, valueRange.endInclusive)
val fractionStart = calcFraction(valueRange.start, valueRange.endInclusive, coercedStart)
val fractionEnd = calcFraction(valueRange.start, valueRange.endInclusive, coercedEnd)
val startSteps = floor(steps * fractionEnd).toInt()
diff --git a/compose/material3/material3/api/public_plus_experimental_current.txt b/compose/material3/material3/api/public_plus_experimental_current.txt
index de30072..1777393 100644
--- a/compose/material3/material3/api/public_plus_experimental_current.txt
+++ b/compose/material3/material3/api/public_plus_experimental_current.txt
@@ -628,7 +628,7 @@
}
public final class SliderKt {
- method @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void RangeSlider(kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> values, kotlin.jvm.functions.Function1<? super kotlin.ranges.ClosedFloatingPointRange<java.lang.Float>,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.material3.SliderColors colors);
+ method @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void RangeSlider(kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> value, kotlin.jvm.functions.Function1<? super kotlin.ranges.ClosedFloatingPointRange<java.lang.Float>,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.material3.SliderColors colors);
method @androidx.compose.runtime.Composable public static void Slider(float value, kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional androidx.compose.material3.SliderColors colors);
}
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SliderSample.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SliderSample.kt
index e4f3525..93d2bcb 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SliderSample.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SliderSample.kt
@@ -65,7 +65,7 @@
Column {
Text(text = sliderPosition.toString())
RangeSlider(
- values = sliderPosition,
+ value = sliderPosition,
onValueChange = { sliderPosition = it },
valueRange = 0f..100f,
onValueChangeFinished = {
@@ -85,7 +85,7 @@
Text(text = sliderPosition.toString())
RangeSlider(
steps = 5,
- values = sliderPosition,
+ value = sliderPosition,
onValueChange = { sliderPosition = it },
valueRange = 0f..100f,
onValueChangeFinished = {
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/TabSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/TabSamples.kt
index 58325bc..27aed3a 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/TabSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/TabSamples.kt
@@ -138,7 +138,7 @@
"Tab 3 with lots of text" to Icons.Filled.Favorite
)
Column {
- TabRow(selectedTabIndex = state) {
+ ScrollableTabRow(selectedTabIndex = state) {
titlesAndIcons.forEachIndexed { index, (title, icon) ->
LeadingIconTab(
text = { Text(title) },
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderScreenshotTest.kt
index f374513..18428a7 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderScreenshotTest.kt
@@ -285,7 +285,7 @@
Box(wrap.testTag(wrapperTestTag)) {
var position by remember { mutableStateOf(30f..70f) }
RangeSlider(
- values = position,
+ value = position,
valueRange = 0f..100f,
onValueChange = { position = it }, steps = 9,
colors = SliderDefaults.colors(
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderTest.kt
index c6d48e3..95ef9ed 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderTest.kt
@@ -619,7 +619,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -653,7 +653,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -691,7 +691,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -727,7 +727,7 @@
rule.setMaterialContent(lightColorScheme()) {
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -759,7 +759,7 @@
rule.setMaterialContent(lightColorScheme()) {
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it },
valueRange = 0f..rangeEnd.value
)
@@ -794,7 +794,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -832,7 +832,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -872,7 +872,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -908,7 +908,7 @@
slop = LocalViewConfiguration.current.touchSlop
RangeSlider(
modifier = Modifier.testTag(tag),
- values = state.value,
+ value = state.value,
onValueChange = { state.value = it }
)
}
@@ -946,7 +946,7 @@
Row(Modifier.width(500.toDp())) {
Spacer(Modifier.requiredSize(100.toDp()))
RangeSlider(
- values = 0f..0.5f,
+ value = 0f..0.5f,
onValueChange = {},
modifier = Modifier
.testTag(tag)
@@ -973,7 +973,7 @@
rule.setMaterialContent(lightColorScheme()) {
RangeSlider(
- modifier = Modifier.testTag(tag), values = state.value,
+ modifier = Modifier.testTag(tag), value = state.value,
onValueChange = { state.value = it }
)
}
@@ -1026,7 +1026,7 @@
// Slider with [0,5,10,15,20] possible values
rule.setMaterialContent(lightColorScheme()) {
RangeSlider(
- modifier = Modifier.testTag(tag), values = state.value,
+ modifier = Modifier.testTag(tag), value = state.value,
steps = 3,
valueRange = 0f..20f,
onValueChange = { state.value = it },
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
index 009420a..de0d27c 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
@@ -264,16 +264,16 @@
*
* @sample androidx.compose.material3.samples.StepRangeSliderSample
*
- * @param values current values of the RangeSlider. If either value is outside of [valueRange]
+ * @param value current values of the RangeSlider. If either value is outside of [valueRange]
* provided, it will be coerced to this range.
* @param onValueChange lambda in which values should be updated
* @param modifier modifiers for the Range Slider layout
* @param enabled whether or not component is enabled and can we interacted with or not
- * @param valueRange range of values that Range Slider values can take. Passed [values] will be
+ * @param valueRange range of values that Range Slider values can take. Passed [value] will be
* coerced to this range
* @param steps if greater than 0, specifies the amounts of discrete values, evenly distributed
* between across the whole value range. If 0, range slider will behave as a continuous slider and
- * allow to choose any values from the range specified. Must not be negative.
+ * allow to choose any value from the range specified. Must not be negative.
* @param onValueChangeFinished lambda to be invoked when value change has ended. This callback
* shouldn't be used to update the range slider values (use [onValueChange] for that), but rather to
* know when the user has completed selecting a new value by ending a drag or a click.
@@ -283,7 +283,7 @@
@Composable
@ExperimentalMaterial3Api
fun RangeSlider(
- values: ClosedFloatingPointRange<Float>,
+ value: ClosedFloatingPointRange<Float>,
onValueChange: (ClosedFloatingPointRange<Float>) -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
@@ -298,7 +298,7 @@
require(steps >= 0) { "steps should be >= 0" }
val onValueChangeState = rememberUpdatedState<(ClosedFloatingPointRange<Float>) -> Unit> {
- if (it != values) {
+ if (it != value) {
onValueChange(it)
}
}
@@ -327,8 +327,8 @@
fun scaleToOffset(userValue: Float) =
scale(valueRange.start, valueRange.endInclusive, userValue, minPx, maxPx)
- val rawOffsetStart = remember { mutableStateOf(scaleToOffset(values.start)) }
- val rawOffsetEnd = remember { mutableStateOf(scaleToOffset(values.endInclusive)) }
+ val rawOffsetStart = remember { mutableStateOf(scaleToOffset(value.start)) }
+ val rawOffsetEnd = remember { mutableStateOf(scaleToOffset(value.endInclusive)) }
val gestureEndAction = rememberUpdatedState<(Boolean) -> Unit> {
onValueChangeFinished?.invoke()
@@ -337,14 +337,14 @@
val onDrag = rememberUpdatedState<(Boolean, Float) -> Unit> { isStart, offset ->
val offsetRange = if (isStart) {
rawOffsetStart.value = (rawOffsetStart.value + offset)
- rawOffsetEnd.value = scaleToOffset(values.endInclusive)
+ rawOffsetEnd.value = scaleToOffset(value.endInclusive)
val offsetEnd = rawOffsetEnd.value
var offsetStart = rawOffsetStart.value.coerceIn(minPx, offsetEnd)
offsetStart = snapValueToTick(offsetStart, tickFractions, minPx, maxPx)
offsetStart..offsetEnd
} else {
rawOffsetEnd.value = (rawOffsetEnd.value + offset)
- rawOffsetStart.value = scaleToOffset(values.start)
+ rawOffsetStart.value = scaleToOffset(value.start)
val offsetStart = rawOffsetStart.value
var offsetEnd = rawOffsetEnd.value.coerceIn(offsetStart, maxPx)
offsetEnd = snapValueToTick(offsetEnd, tickFractions, minPx, maxPx)
@@ -367,8 +367,8 @@
onDrag,
)
// The positions of the thumbs are dependant on each other.
- val coercedStart = values.start.coerceIn(valueRange.start, values.endInclusive)
- val coercedEnd = values.endInclusive.coerceIn(values.start, valueRange.endInclusive)
+ val coercedStart = value.start.coerceIn(valueRange.start, value.endInclusive)
+ val coercedEnd = value.endInclusive.coerceIn(value.start, valueRange.endInclusive)
val fractionStart = calcFraction(valueRange.start, valueRange.endInclusive, coercedStart)
val fractionEnd = calcFraction(valueRange.start, valueRange.endInclusive, coercedEnd)
val startSteps = floor(steps * fractionEnd).toInt()
diff --git a/compose/runtime/runtime-saveable/samples/build.gradle b/compose/runtime/runtime-saveable/samples/build.gradle
index d111a53..d1335e4 100644
--- a/compose/runtime/runtime-saveable/samples/build.gradle
+++ b/compose/runtime/runtime-saveable/samples/build.gradle
@@ -31,8 +31,8 @@
compileOnly projectOrArtifact(":annotation:annotation-sampled")
- implementation projectOrArtifact(":compose:foundation:foundation")
- implementation projectOrArtifact(":compose:material:material")
+ implementation "androidx.compose.foundation:foundation:1.2.0-rc01"
+ implementation "androidx.compose.material:material:1.2.0-rc01"
implementation project(":compose:runtime:runtime")
implementation project(":compose:runtime:runtime-saveable")
}
diff --git a/compose/runtime/runtime/api/1.2.0-beta04.txt b/compose/runtime/runtime/api/1.2.0-beta04.txt
index 6e6e8862..67e47e4 100644
--- a/compose/runtime/runtime/api/1.2.0-beta04.txt
+++ b/compose/runtime/runtime/api/1.2.0-beta04.txt
@@ -946,7 +946,7 @@
property public abstract boolean isEmpty;
}
- public interface CompositionGroup extends androidx.compose.runtime.tooling.CompositionData {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface CompositionGroup extends androidx.compose.runtime.tooling.CompositionData {
method public Iterable<java.lang.Object> getData();
method public default Object? getIdentity();
method public Object getKey();
diff --git a/compose/runtime/runtime/api/public_plus_experimental_1.2.0-beta04.txt b/compose/runtime/runtime/api/public_plus_experimental_1.2.0-beta04.txt
index 0f4eed9..192802e 100644
--- a/compose/runtime/runtime/api/public_plus_experimental_1.2.0-beta04.txt
+++ b/compose/runtime/runtime/api/public_plus_experimental_1.2.0-beta04.txt
@@ -1022,7 +1022,7 @@
property public abstract boolean isEmpty;
}
- public interface CompositionGroup extends androidx.compose.runtime.tooling.CompositionData {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface CompositionGroup extends androidx.compose.runtime.tooling.CompositionData {
method public Iterable<java.lang.Object> getData();
method public default Object? getIdentity();
method public Object getKey();
diff --git a/compose/runtime/runtime/api/restricted_1.2.0-beta04.txt b/compose/runtime/runtime/api/restricted_1.2.0-beta04.txt
index f6951b7..72d5a5a 100644
--- a/compose/runtime/runtime/api/restricted_1.2.0-beta04.txt
+++ b/compose/runtime/runtime/api/restricted_1.2.0-beta04.txt
@@ -985,7 +985,7 @@
property public abstract boolean isEmpty;
}
- public interface CompositionGroup extends androidx.compose.runtime.tooling.CompositionData {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface CompositionGroup extends androidx.compose.runtime.tooling.CompositionData {
method public Iterable<java.lang.Object> getData();
method public default Object? getIdentity();
method public Object getKey();
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
index f8ace7f..3435fd2 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
@@ -1776,7 +1776,7 @@
is RecomposeScopeImpl -> {
val composition = previous.composition
if (composition != null) {
- previous.composition = null
+ previous.release()
composition.pendingInvalidScopes = true
}
}
@@ -2671,7 +2671,7 @@
val composition = data.composition
if (composition != null) {
composition.pendingInvalidScopes = true
- data.composition = null
+ data.release()
}
reader.reposition(group)
recordSlotTableOperation { _, slots, _ ->
@@ -2980,7 +2980,7 @@
// The recompose scope is always at slot 0 of a restart group.
val recomposeScope = slots.slot(anchor, 0) as? RecomposeScopeImpl
// Check for null as the anchor might not be for a recompose scope
- recomposeScope?.let { it.composition = toComposition }
+ recomposeScope?.adoptedBy(toComposition)
}
}
}
@@ -3975,7 +3975,7 @@
val composition = slot.composition
if (composition != null) {
composition.pendingInvalidScopes = true
- slot.composition = null
+ slot.release()
}
}
}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
index 1dc664c..1b652e8 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
@@ -405,6 +405,12 @@
internal val derivedStateDependencies get() = derivedStates.values.filterNotNull()
/**
+ * Used for testing. Returns the conditional scopes being tracked by the composer
+ */
+ internal val conditionalScopes: List<RecomposeScopeImpl> get() =
+ conditionallyInvalidatedScopes.toList()
+
+ /**
* A list of changes calculated by [Composer] to be applied to the [Applier] and the
* [SlotTable] to reflect the result of composition. This is a list of lambdas that need to
* be invoked in order to produce the desired effects.
@@ -691,6 +697,7 @@
private fun cleanUpDerivedStateObservations() {
derivedStates.removeValueIf { derivedValue -> derivedValue !in observations }
+ conditionallyInvalidatedScopes.removeValueIf { scope -> !scope.isConditional }
}
override fun recordReadOf(value: Any) {
@@ -1110,3 +1117,16 @@
this[key] = IdentityArraySet<V>().also { it.add(value) }
}
}
+
+/**
+ * This is provided natively in API 26 and this should be removed if 26 is made the lowest API
+ * level supported
+ */
+private inline fun <E> HashSet<E>.removeValueIf(predicate: (E) -> Boolean) {
+ val iter = iterator()
+ while (iter.hasNext()) {
+ if (predicate(iter.next())) {
+ iter.remove()
+ }
+ }
+}
\ No newline at end of file
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt
index 36271aa..4914cce 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt
@@ -47,11 +47,14 @@
* [Composer.startRestartGroup] and is used to track how to restart the group.
*/
internal class RecomposeScopeImpl(
- var composition: CompositionImpl?
+ composition: CompositionImpl?
) : ScopeUpdateScope, RecomposeScope {
private var flags: Int = 0
+ var composition: CompositionImpl? = composition
+ private set
+
/**
* An anchor to the location in the slot table that start the group associated with this
* recompose scope.
@@ -150,6 +153,24 @@
composition?.invalidate(this, value) ?: InvalidationResult.IGNORED
/**
+ * Release the recompose scope. This is called when the recompose scope has been removed by the
+ * compostion because the part of the composition it was tracking was removed.
+ */
+ fun release() {
+ composition = null
+ trackedInstances = null
+ trackedDependencies = null
+ }
+
+ /**
+ * Called when the data tracked by this recompose scope moves to a different composition when
+ * for example, the movable content it is part of has moved.
+ */
+ fun adoptedBy(composition: CompositionImpl) {
+ this.composition = composition
+ }
+
+ /**
* Invalidate the group which will cause [composition] to request this scope be recomposed.
*
* Unlike [invalidateForResult], this method is thread safe and calls the thread safe
diff --git a/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/CompositionAndDerivedStateTests.kt b/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/CompositionAndDerivedStateTests.kt
index 125ac7d..78cf889 100644
--- a/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/CompositionAndDerivedStateTests.kt
+++ b/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/CompositionAndDerivedStateTests.kt
@@ -503,9 +503,36 @@
// Validate there are only 2 observed dependencies, one for intermediateState, one for itemValue
val observed = (composition as? CompositionImpl)?.derivedStateDependencies ?: emptyList()
- println(observed)
assertEquals(2, observed.count())
}
+
+ @Test
+ fun changingDerivedStateShouldNotAccumulateConditionalScopes() = compositionTest {
+
+ var reload by mutableStateOf(0)
+
+ compose {
+ val derivedState = remember {
+ derivedStateOf {
+ List(reload) { it }
+ }
+ }
+
+ if (reload % 2 == 0) {
+ Wrap {
+ Text("${derivedState.value.size}")
+ }
+ }
+ }
+
+ reload++
+
+ advance()
+
+ val conditionalScopes = (composition as? CompositionImpl)?.conditionalScopes ?: emptyList()
+
+ assertEquals(0, conditionalScopes.count { it.isConditional })
+ }
}
@Composable
diff --git a/compose/ui/ui-graphics/api/1.2.0-beta04.txt b/compose/ui/ui-graphics/api/1.2.0-beta04.txt
index 2fabc04..efe0b24 100644
--- a/compose/ui/ui-graphics/api/1.2.0-beta04.txt
+++ b/compose/ui/ui-graphics/api/1.2.0-beta04.txt
@@ -417,7 +417,7 @@
public final class Float16Kt {
}
- public interface ImageBitmap {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ImageBitmap {
method public androidx.compose.ui.graphics.colorspace.ColorSpace getColorSpace();
method public int getConfig();
method public boolean getHasAlpha();
@@ -662,7 +662,7 @@
property public final int NonZero;
}
- public interface PathMeasure {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface PathMeasure {
method public float getLength();
method public boolean getSegment(float startDistance, float stopDistance, androidx.compose.ui.graphics.Path destination, optional boolean startWithMoveTo);
method public void setPath(androidx.compose.ui.graphics.Path? path, boolean forceClosed);
diff --git a/compose/ui/ui-graphics/api/public_plus_experimental_1.2.0-beta04.txt b/compose/ui/ui-graphics/api/public_plus_experimental_1.2.0-beta04.txt
index 7e95ddb..c89fc9a 100644
--- a/compose/ui/ui-graphics/api/public_plus_experimental_1.2.0-beta04.txt
+++ b/compose/ui/ui-graphics/api/public_plus_experimental_1.2.0-beta04.txt
@@ -420,7 +420,7 @@
public final class Float16Kt {
}
- public interface ImageBitmap {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ImageBitmap {
method public androidx.compose.ui.graphics.colorspace.ColorSpace getColorSpace();
method public int getConfig();
method public boolean getHasAlpha();
@@ -665,7 +665,7 @@
property public final int NonZero;
}
- public interface PathMeasure {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface PathMeasure {
method public float getLength();
method public boolean getSegment(float startDistance, float stopDistance, androidx.compose.ui.graphics.Path destination, optional boolean startWithMoveTo);
method public void setPath(androidx.compose.ui.graphics.Path? path, boolean forceClosed);
diff --git a/compose/ui/ui-graphics/api/restricted_1.2.0-beta04.txt b/compose/ui/ui-graphics/api/restricted_1.2.0-beta04.txt
index c863688..751e973 100644
--- a/compose/ui/ui-graphics/api/restricted_1.2.0-beta04.txt
+++ b/compose/ui/ui-graphics/api/restricted_1.2.0-beta04.txt
@@ -449,7 +449,7 @@
public final class Float16Kt {
}
- public interface ImageBitmap {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ImageBitmap {
method public androidx.compose.ui.graphics.colorspace.ColorSpace getColorSpace();
method public int getConfig();
method public boolean getHasAlpha();
@@ -694,7 +694,7 @@
property public final int NonZero;
}
- public interface PathMeasure {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface PathMeasure {
method public float getLength();
method public boolean getSegment(float startDistance, float stopDistance, androidx.compose.ui.graphics.Path destination, optional boolean startWithMoveTo);
method public void setPath(androidx.compose.ui.graphics.Path? path, boolean forceClosed);
diff --git a/compose/ui/ui-graphics/samples/build.gradle b/compose/ui/ui-graphics/samples/build.gradle
index 94d945b..604e896 100644
--- a/compose/ui/ui-graphics/samples/build.gradle
+++ b/compose/ui/ui-graphics/samples/build.gradle
@@ -32,7 +32,7 @@
api(project(":compose:ui:ui-unit"))
implementation("androidx.compose.foundation:foundation:1.0.0")
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
implementation(project(":compose:ui:ui-graphics"))
implementation(project(":compose:ui:ui-util"))
}
diff --git a/compose/ui/ui-inspection/build.gradle b/compose/ui/ui-inspection/build.gradle
index f0f3575..3da47da 100644
--- a/compose/ui/ui-inspection/build.gradle
+++ b/compose/ui/ui-inspection/build.gradle
@@ -33,7 +33,7 @@
// thus all its transitive dependencies will be present too.
compileOnly(libs.kotlinStdlib)
compileOnly("androidx.inspection:inspection:1.0.0")
- compileOnly(project(":compose:runtime:runtime"))
+ compileOnly("androidx.compose.runtime:runtime:1.2.0-rc01")
compileOnly(project(":compose:ui:ui"))
// we ignore its transitive dependencies, because ui-inspection should
// depend on them as "compile-only" deps.
diff --git a/compose/ui/ui-test-junit4/api/1.2.0-beta04.txt b/compose/ui/ui-test-junit4/api/1.2.0-beta04.txt
index bc83830..d69e7e0 100644
--- a/compose/ui/ui-test-junit4/api/1.2.0-beta04.txt
+++ b/compose/ui/ui-test-junit4/api/1.2.0-beta04.txt
@@ -49,7 +49,7 @@
public final class AndroidSynchronization_androidKt {
}
- public interface ComposeContentTestRule extends androidx.compose.ui.test.junit4.ComposeTestRule {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ComposeContentTestRule extends androidx.compose.ui.test.junit4.ComposeTestRule {
method public void setContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
}
@@ -59,7 +59,7 @@
public final class ComposeRootRegistry_androidKt {
}
- public interface ComposeTestRule extends org.junit.rules.TestRule androidx.compose.ui.test.SemanticsNodeInteractionsProvider {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ComposeTestRule extends org.junit.rules.TestRule androidx.compose.ui.test.SemanticsNodeInteractionsProvider {
method public suspend Object? awaitIdle(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public androidx.compose.ui.unit.Density getDensity();
method public androidx.compose.ui.test.MainTestClock getMainClock();
diff --git a/compose/ui/ui-test-junit4/api/public_plus_experimental_1.2.0-beta04.txt b/compose/ui/ui-test-junit4/api/public_plus_experimental_1.2.0-beta04.txt
index 7d11b78..97512e2 100644
--- a/compose/ui/ui-test-junit4/api/public_plus_experimental_1.2.0-beta04.txt
+++ b/compose/ui/ui-test-junit4/api/public_plus_experimental_1.2.0-beta04.txt
@@ -90,7 +90,7 @@
public final class AndroidSynchronization_androidKt {
}
- public interface ComposeContentTestRule extends androidx.compose.ui.test.junit4.ComposeTestRule {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ComposeContentTestRule extends androidx.compose.ui.test.junit4.ComposeTestRule {
method public void setContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
}
@@ -100,7 +100,7 @@
public final class ComposeRootRegistry_androidKt {
}
- public interface ComposeTestRule extends org.junit.rules.TestRule androidx.compose.ui.test.SemanticsNodeInteractionsProvider {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ComposeTestRule extends org.junit.rules.TestRule androidx.compose.ui.test.SemanticsNodeInteractionsProvider {
method public suspend Object? awaitIdle(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public androidx.compose.ui.unit.Density getDensity();
method public androidx.compose.ui.test.MainTestClock getMainClock();
diff --git a/compose/ui/ui-test-junit4/api/restricted_1.2.0-beta04.txt b/compose/ui/ui-test-junit4/api/restricted_1.2.0-beta04.txt
index bc83830..d69e7e0 100644
--- a/compose/ui/ui-test-junit4/api/restricted_1.2.0-beta04.txt
+++ b/compose/ui/ui-test-junit4/api/restricted_1.2.0-beta04.txt
@@ -49,7 +49,7 @@
public final class AndroidSynchronization_androidKt {
}
- public interface ComposeContentTestRule extends androidx.compose.ui.test.junit4.ComposeTestRule {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ComposeContentTestRule extends androidx.compose.ui.test.junit4.ComposeTestRule {
method public void setContent(kotlin.jvm.functions.Function0<kotlin.Unit> composable);
}
@@ -59,7 +59,7 @@
public final class ComposeRootRegistry_androidKt {
}
- public interface ComposeTestRule extends org.junit.rules.TestRule androidx.compose.ui.test.SemanticsNodeInteractionsProvider {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface ComposeTestRule extends org.junit.rules.TestRule androidx.compose.ui.test.SemanticsNodeInteractionsProvider {
method public suspend Object? awaitIdle(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public androidx.compose.ui.unit.Density getDensity();
method public androidx.compose.ui.test.MainTestClock getMainClock();
diff --git a/compose/ui/ui-test/api/1.2.0-beta04.txt b/compose/ui/ui-test/api/1.2.0-beta04.txt
index 3ded8f1..6955181 100644
--- a/compose/ui/ui-test/api/1.2.0-beta04.txt
+++ b/compose/ui/ui-test/api/1.2.0-beta04.txt
@@ -241,7 +241,7 @@
method public static boolean performKeyPress(androidx.compose.ui.test.SemanticsNodeInteraction, android.view.KeyEvent keyEvent);
}
- public interface MainTestClock {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface MainTestClock {
method public void advanceTimeBy(long milliseconds, optional boolean ignoreFrameDuration);
method public void advanceTimeByFrame();
method public void advanceTimeUntil(optional long timeoutMillis, kotlin.jvm.functions.Function0<java.lang.Boolean> condition);
@@ -321,7 +321,7 @@
method public operator androidx.compose.ui.test.SemanticsNodeInteraction get(int index);
}
- public interface SemanticsNodeInteractionsProvider {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface SemanticsNodeInteractionsProvider {
method public androidx.compose.ui.test.SemanticsNodeInteractionCollection onAllNodes(androidx.compose.ui.test.SemanticsMatcher matcher, optional boolean useUnmergedTree);
method public androidx.compose.ui.test.SemanticsNodeInteraction onNode(androidx.compose.ui.test.SemanticsMatcher matcher, optional boolean useUnmergedTree);
}
diff --git a/compose/ui/ui-test/api/public_plus_experimental_1.2.0-beta04.txt b/compose/ui/ui-test/api/public_plus_experimental_1.2.0-beta04.txt
index 009d111..719ee4f 100644
--- a/compose/ui/ui-test/api/public_plus_experimental_1.2.0-beta04.txt
+++ b/compose/ui/ui-test/api/public_plus_experimental_1.2.0-beta04.txt
@@ -281,7 +281,7 @@
method public static boolean performKeyPress(androidx.compose.ui.test.SemanticsNodeInteraction, android.view.KeyEvent keyEvent);
}
- public interface MainTestClock {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface MainTestClock {
method public void advanceTimeBy(long milliseconds, optional boolean ignoreFrameDuration);
method public void advanceTimeByFrame();
method public void advanceTimeUntil(optional long timeoutMillis, kotlin.jvm.functions.Function0<java.lang.Boolean> condition);
@@ -423,7 +423,7 @@
method public operator androidx.compose.ui.test.SemanticsNodeInteraction get(int index);
}
- public interface SemanticsNodeInteractionsProvider {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface SemanticsNodeInteractionsProvider {
method public androidx.compose.ui.test.SemanticsNodeInteractionCollection onAllNodes(androidx.compose.ui.test.SemanticsMatcher matcher, optional boolean useUnmergedTree);
method public androidx.compose.ui.test.SemanticsNodeInteraction onNode(androidx.compose.ui.test.SemanticsMatcher matcher, optional boolean useUnmergedTree);
}
diff --git a/compose/ui/ui-test/api/restricted_1.2.0-beta04.txt b/compose/ui/ui-test/api/restricted_1.2.0-beta04.txt
index 5a129d0..949c8fe 100644
--- a/compose/ui/ui-test/api/restricted_1.2.0-beta04.txt
+++ b/compose/ui/ui-test/api/restricted_1.2.0-beta04.txt
@@ -242,7 +242,7 @@
method public static boolean performKeyPress(androidx.compose.ui.test.SemanticsNodeInteraction, android.view.KeyEvent keyEvent);
}
- public interface MainTestClock {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface MainTestClock {
method public void advanceTimeBy(long milliseconds, optional boolean ignoreFrameDuration);
method public void advanceTimeByFrame();
method public void advanceTimeUntil(optional long timeoutMillis, kotlin.jvm.functions.Function0<java.lang.Boolean> condition);
@@ -322,7 +322,7 @@
method public operator androidx.compose.ui.test.SemanticsNodeInteraction get(int index);
}
- public interface SemanticsNodeInteractionsProvider {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface SemanticsNodeInteractionsProvider {
method public androidx.compose.ui.test.SemanticsNodeInteractionCollection onAllNodes(androidx.compose.ui.test.SemanticsMatcher matcher, optional boolean useUnmergedTree);
method public androidx.compose.ui.test.SemanticsNodeInteraction onNode(androidx.compose.ui.test.SemanticsMatcher matcher, optional boolean useUnmergedTree);
}
diff --git a/compose/ui/ui-test/samples/build.gradle b/compose/ui/ui-test/samples/build.gradle
index 2dc4b822..1fe96d3 100644
--- a/compose/ui/ui-test/samples/build.gradle
+++ b/compose/ui/ui-test/samples/build.gradle
@@ -34,8 +34,7 @@
implementation(project(":compose:ui:ui-test"))
implementation(project(":compose:ui:ui-test-junit4"))
- // Can't use the artifact of animation due to https://github.com/gradle/gradle/issues/19882
- implementation(project(":compose:animation:animation"))
+ implementation("androidx.compose.animation:animation:1.2.0-rc01")
implementation("androidx.compose.material:material:1.1.0")
}
diff --git a/compose/ui/ui-text-google-fonts/build.gradle b/compose/ui/ui-text-google-fonts/build.gradle
index 4faa30e..5f637d7 100644
--- a/compose/ui/ui-text-google-fonts/build.gradle
+++ b/compose/ui/ui-text-google-fonts/build.gradle
@@ -29,7 +29,7 @@
implementation(libs.kotlinStdlib)
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
implementation(project(":compose:ui:ui-text"))
implementation("androidx.core:core:1.8.0")
diff --git a/compose/ui/ui-text/api/1.2.0-beta04.txt b/compose/ui/ui-text/api/1.2.0-beta04.txt
index 0aed13e..d71ded4 100644
--- a/compose/ui/ui-text/api/1.2.0-beta04.txt
+++ b/compose/ui/ui-text/api/1.2.0-beta04.txt
@@ -153,7 +153,7 @@
public final class MultiParagraphKt {
}
- public interface Paragraph {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface Paragraph {
method public androidx.compose.ui.text.style.ResolvedTextDirection getBidiRunDirection(int offset);
method public androidx.compose.ui.geometry.Rect getBoundingBox(int offset);
method public androidx.compose.ui.geometry.Rect getCursorRect(int offset);
diff --git a/compose/ui/ui-text/api/public_plus_experimental_1.2.0-beta04.txt b/compose/ui/ui-text/api/public_plus_experimental_1.2.0-beta04.txt
index c315928..bb957dc 100644
--- a/compose/ui/ui-text/api/public_plus_experimental_1.2.0-beta04.txt
+++ b/compose/ui/ui-text/api/public_plus_experimental_1.2.0-beta04.txt
@@ -165,7 +165,7 @@
public final class MultiParagraphKt {
}
- public interface Paragraph {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface Paragraph {
method public androidx.compose.ui.text.style.ResolvedTextDirection getBidiRunDirection(int offset);
method public androidx.compose.ui.geometry.Rect getBoundingBox(int offset);
method public androidx.compose.ui.geometry.Rect getCursorRect(int offset);
@@ -230,7 +230,7 @@
}
@androidx.compose.runtime.Immutable public final class ParagraphStyle {
- ctor @androidx.compose.ui.text.ExperimentalTextApi public ParagraphStyle(optional androidx.compose.ui.text.style.TextAlign? textAlign, optional androidx.compose.ui.text.style.TextDirection? textDirection, optional long lineHeight, optional androidx.compose.ui.text.style.TextIndent? textIndent, optional androidx.compose.ui.text.PlatformParagraphStyle? platformStyle, optional androidx.compose.ui.text.style.LineHeightStyle? lineHeightStyle);
+ ctor @androidx.compose.ui.text.ExperimentalTextApi public ParagraphStyle(optional androidx.compose.ui.text.style.TextAlign? textAlign, optional androidx.compose.ui.text.style.TextDirection? textDirection, optional long lineHeight, optional androidx.compose.ui.text.style.TextIndent? textIndent, optional @androidx.compose.ui.text.ExperimentalTextApi androidx.compose.ui.text.PlatformParagraphStyle? platformStyle, optional @androidx.compose.ui.text.ExperimentalTextApi androidx.compose.ui.text.style.LineHeightStyle? lineHeightStyle);
ctor public ParagraphStyle(optional androidx.compose.ui.text.style.TextAlign? textAlign, optional androidx.compose.ui.text.style.TextDirection? textDirection, optional long lineHeight, optional androidx.compose.ui.text.style.TextIndent? textIndent);
method public androidx.compose.ui.text.ParagraphStyle copy(optional androidx.compose.ui.text.style.TextAlign? textAlign, optional androidx.compose.ui.text.style.TextDirection? textDirection, optional long lineHeight, optional androidx.compose.ui.text.style.TextIndent? textIndent);
method @androidx.compose.ui.text.ExperimentalTextApi public androidx.compose.ui.text.ParagraphStyle copy(optional androidx.compose.ui.text.style.TextAlign? textAlign, optional androidx.compose.ui.text.style.TextDirection? textDirection, optional long lineHeight, optional androidx.compose.ui.text.style.TextIndent? textIndent, optional androidx.compose.ui.text.PlatformParagraphStyle? platformStyle, optional androidx.compose.ui.text.style.LineHeightStyle? lineHeightStyle);
diff --git a/compose/ui/ui-text/api/restricted_1.2.0-beta04.txt b/compose/ui/ui-text/api/restricted_1.2.0-beta04.txt
index 0aed13e..d71ded4 100644
--- a/compose/ui/ui-text/api/restricted_1.2.0-beta04.txt
+++ b/compose/ui/ui-text/api/restricted_1.2.0-beta04.txt
@@ -153,7 +153,7 @@
public final class MultiParagraphKt {
}
- public interface Paragraph {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface Paragraph {
method public androidx.compose.ui.text.style.ResolvedTextDirection getBidiRunDirection(int offset);
method public androidx.compose.ui.geometry.Rect getBoundingBox(int offset);
method public androidx.compose.ui.geometry.Rect getCursorRect(int offset);
diff --git a/compose/ui/ui-text/build.gradle b/compose/ui/ui-text/build.gradle
index ce2d7b6..485e041 100644
--- a/compose/ui/ui-text/build.gradle
+++ b/compose/ui/ui-text/build.gradle
@@ -40,8 +40,8 @@
api("androidx.annotation:annotation:1.1.0")
// when updating the runtime version please also update the runtime-saveable version
- implementation(project(":compose:runtime:runtime"))
- implementation(project(":compose:runtime:runtime-saveable"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
+ implementation("androidx.compose.runtime:runtime-saveable:1.2.0-rc01")
implementation(project(":compose:ui:ui-util"))
implementation(libs.kotlinStdlib)
diff --git a/compose/ui/ui-text/samples/build.gradle b/compose/ui/ui-text/samples/build.gradle
index 4e45de8f..4d1e039 100644
--- a/compose/ui/ui-text/samples/build.gradle
+++ b/compose/ui/ui-text/samples/build.gradle
@@ -32,7 +32,7 @@
implementation("androidx.compose.foundation:foundation:1.0.0")
implementation("androidx.compose.material:material:1.0.0")
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
implementation(project(":compose:ui:ui"))
implementation(project(":compose:ui:ui-text"))
}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/MultiParagraphIntegrationTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/MultiParagraphIntegrationTest.kt
index d5061fc..0c6493a 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/MultiParagraphIntegrationTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/MultiParagraphIntegrationTest.kt
@@ -26,6 +26,7 @@
import androidx.compose.ui.text.font.toFontFamily
import androidx.compose.ui.text.intl.LocaleList
import androidx.compose.ui.text.matchers.assertThat
+import androidx.compose.ui.text.matchers.isZero
import androidx.compose.ui.text.platform.AndroidParagraph
import androidx.compose.ui.text.style.ResolvedTextDirection
import androidx.compose.ui.text.style.TextAlign
@@ -590,20 +591,21 @@
assertThat(paragraph.getLineForOffset(3)).isEqualTo(2)
}
- @Test(expected = java.lang.IllegalArgumentException::class)
- fun getLineForOffset_negative_throw_exception() {
+ @Test
+ fun getLineForOffset_negative_returnsZero() {
val text = "abc"
val paragraph = simpleMultiParagraph(text = text)
- paragraph.getLineForOffset(-1)
+ assertThat(paragraph.getLineForOffset(-1)).isZero()
}
- @Test(expected = java.lang.IllegalArgumentException::class)
- fun getLineForOffset_larger_than_length_throw_exception() {
- val text = "abc"
+ @Test
+ fun getLineForOffset_larger_than_length_returnsLastLine() {
+ val text = "abc\ndef"
val paragraph = simpleMultiParagraph(text = text)
- paragraph.getLineForOffset(text.length + 1)
+ assertThat(paragraph.getLineForOffset(text.length + 1))
+ .isEqualTo(1)
}
@Test
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/MultiParagraph.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/MultiParagraph.kt
index 3f2544a..e4a7eb7 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/MultiParagraph.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/MultiParagraph.kt
@@ -621,10 +621,10 @@
* beyond the end of the text, you get the last line.
*/
fun getLineForOffset(offset: Int): Int {
- requireIndexInRangeInclusiveEnd(offset)
-
- val paragraphIndex = if (offset == annotatedString.length) {
+ val paragraphIndex = if (offset >= annotatedString.length) {
paragraphInfoList.lastIndex
+ } else if (offset < 0) {
+ 0
} else {
findParagraphByIndex(paragraphInfoList, offset)
}
diff --git a/compose/ui/ui-tooling-data/build.gradle b/compose/ui/ui-tooling-data/build.gradle
index d2233ce..54054bf 100644
--- a/compose/ui/ui-tooling-data/build.gradle
+++ b/compose/ui/ui-tooling-data/build.gradle
@@ -31,7 +31,7 @@
api "androidx.annotation:annotation:1.1.0"
- api(project(":compose:runtime:runtime"))
+ api("androidx.compose.runtime:runtime:1.2.0-rc01")
api(project(":compose:ui:ui"))
androidTestImplementation project(":compose:ui:ui-test-junit4")
diff --git a/compose/ui/ui-unit/samples/build.gradle b/compose/ui/ui-unit/samples/build.gradle
index 8bb04d5..253a1ed 100644
--- a/compose/ui/ui-unit/samples/build.gradle
+++ b/compose/ui/ui-unit/samples/build.gradle
@@ -30,7 +30,7 @@
compileOnly(project(":annotation:annotation-sampled"))
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
implementation(project(":compose:ui:ui"))
implementation(project(":compose:ui:ui-unit"))
}
diff --git a/compose/ui/ui-viewbinding/samples/build.gradle b/compose/ui/ui-viewbinding/samples/build.gradle
index 64a65d0..626cf9b 100644
--- a/compose/ui/ui-viewbinding/samples/build.gradle
+++ b/compose/ui/ui-viewbinding/samples/build.gradle
@@ -28,7 +28,7 @@
implementation(libs.kotlinStdlib)
compileOnly(project(":annotation:annotation-sampled"))
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
implementation(project(":compose:ui:ui"))
implementation(project(":compose:ui:ui-viewbinding"))
// Used when creating layouts that contain a FragmentContainerView
diff --git a/compose/ui/ui/api/1.2.0-beta04.txt b/compose/ui/ui/api/1.2.0-beta04.txt
index 7af1e9a..ebbae98 100644
--- a/compose/ui/ui/api/1.2.0-beta04.txt
+++ b/compose/ui/ui/api/1.2.0-beta04.txt
@@ -301,7 +301,7 @@
method public static androidx.compose.ui.Modifier onFocusEvent(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusState,kotlin.Unit> onFocusEvent);
}
- public interface FocusManager {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface FocusManager {
method public void clearFocus(optional boolean force);
method public boolean moveFocus(int focusDirection);
}
@@ -1851,7 +1851,7 @@
property public abstract androidx.compose.ui.unit.LayoutDirection layoutDirection;
}
- public interface LayoutCoordinates {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface LayoutCoordinates {
method public operator int get(androidx.compose.ui.layout.AlignmentLine alignmentLine);
method public androidx.compose.ui.layout.LayoutCoordinates? getParentCoordinates();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentLayoutCoordinates();
@@ -2225,7 +2225,7 @@
property public final boolean showLayoutBounds;
}
- public interface AccessibilityManager {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface AccessibilityManager {
method public long calculateRecommendedTimeoutMillis(long originalTimeoutMillis, optional boolean containsIcons, optional boolean containsText, optional boolean containsControls);
}
@@ -2425,7 +2425,7 @@
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier testTag(androidx.compose.ui.Modifier, String tag);
}
- public interface TextToolbar {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface TextToolbar {
method public androidx.compose.ui.platform.TextToolbarStatus getStatus();
method public void hide();
method public void showMenu(androidx.compose.ui.geometry.Rect rect, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onCopyRequested, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onPasteRequested, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onCutRequested, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onSelectAllRequested);
@@ -3006,9 +3006,11 @@
method public boolean getDismissOnBackPress();
method public boolean getDismissOnClickOutside();
method public androidx.compose.ui.window.SecureFlagPolicy getSecurePolicy();
+ method public boolean getUsePlatformDefaultWidth();
property public final boolean dismissOnBackPress;
property public final boolean dismissOnClickOutside;
property public final androidx.compose.ui.window.SecureFlagPolicy securePolicy;
+ property public final boolean usePlatformDefaultWidth;
}
public interface DialogWindowProvider {
@@ -3028,12 +3030,14 @@
method public boolean getExcludeFromSystemGesture();
method public boolean getFocusable();
method public androidx.compose.ui.window.SecureFlagPolicy getSecurePolicy();
+ method public boolean getUsePlatformDefaultWidth();
property public final boolean clippingEnabled;
property public final boolean dismissOnBackPress;
property public final boolean dismissOnClickOutside;
property public final boolean excludeFromSystemGesture;
property public final boolean focusable;
property public final androidx.compose.ui.window.SecureFlagPolicy securePolicy;
+ property public final boolean usePlatformDefaultWidth;
}
public enum SecureFlagPolicy {
diff --git a/compose/ui/ui/api/public_plus_experimental_1.2.0-beta04.txt b/compose/ui/ui/api/public_plus_experimental_1.2.0-beta04.txt
index f6a1774..07824b0 100644
--- a/compose/ui/ui/api/public_plus_experimental_1.2.0-beta04.txt
+++ b/compose/ui/ui/api/public_plus_experimental_1.2.0-beta04.txt
@@ -376,7 +376,7 @@
method public static androidx.compose.ui.Modifier onFocusEvent(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusState,kotlin.Unit> onFocusEvent);
}
- public interface FocusManager {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface FocusManager {
method public void clearFocus(optional boolean force);
method public boolean moveFocus(int focusDirection);
}
@@ -1991,7 +1991,7 @@
property public abstract androidx.compose.ui.unit.LayoutDirection layoutDirection;
}
- public interface LayoutCoordinates {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface LayoutCoordinates {
method public operator int get(androidx.compose.ui.layout.AlignmentLine alignmentLine);
method public androidx.compose.ui.layout.LayoutCoordinates? getParentCoordinates();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentLayoutCoordinates();
@@ -2382,7 +2382,7 @@
property public final boolean showLayoutBounds;
}
- public interface AccessibilityManager {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface AccessibilityManager {
method public long calculateRecommendedTimeoutMillis(long originalTimeoutMillis, optional boolean containsIcons, optional boolean containsText, optional boolean containsControls);
}
@@ -2601,7 +2601,7 @@
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier testTag(androidx.compose.ui.Modifier, String tag);
}
- public interface TextToolbar {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface TextToolbar {
method public androidx.compose.ui.platform.TextToolbarStatus getStatus();
method public void hide();
method public void showMenu(androidx.compose.ui.geometry.Rect rect, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onCopyRequested, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onPasteRequested, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onCutRequested, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onSelectAllRequested);
@@ -3211,11 +3211,11 @@
method public boolean getDismissOnBackPress();
method public boolean getDismissOnClickOutside();
method public androidx.compose.ui.window.SecureFlagPolicy getSecurePolicy();
- method @androidx.compose.ui.ExperimentalComposeUiApi public boolean getUsePlatformDefaultWidth();
+ method public boolean getUsePlatformDefaultWidth();
property public final boolean dismissOnBackPress;
property public final boolean dismissOnClickOutside;
property public final androidx.compose.ui.window.SecureFlagPolicy securePolicy;
- property @androidx.compose.ui.ExperimentalComposeUiApi public final boolean usePlatformDefaultWidth;
+ property public final boolean usePlatformDefaultWidth;
}
public interface DialogWindowProvider {
@@ -3236,14 +3236,14 @@
method public boolean getExcludeFromSystemGesture();
method public boolean getFocusable();
method public androidx.compose.ui.window.SecureFlagPolicy getSecurePolicy();
- method @androidx.compose.ui.ExperimentalComposeUiApi public boolean getUsePlatformDefaultWidth();
+ method public boolean getUsePlatformDefaultWidth();
property public final boolean clippingEnabled;
property public final boolean dismissOnBackPress;
property public final boolean dismissOnClickOutside;
property public final boolean excludeFromSystemGesture;
property public final boolean focusable;
property public final androidx.compose.ui.window.SecureFlagPolicy securePolicy;
- property @androidx.compose.ui.ExperimentalComposeUiApi public final boolean usePlatformDefaultWidth;
+ property public final boolean usePlatformDefaultWidth;
}
public enum SecureFlagPolicy {
diff --git a/compose/ui/ui/api/restricted_1.2.0-beta04.txt b/compose/ui/ui/api/restricted_1.2.0-beta04.txt
index df4d46f..7826e34 100644
--- a/compose/ui/ui/api/restricted_1.2.0-beta04.txt
+++ b/compose/ui/ui/api/restricted_1.2.0-beta04.txt
@@ -301,7 +301,7 @@
method public static androidx.compose.ui.Modifier onFocusEvent(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusState,kotlin.Unit> onFocusEvent);
}
- public interface FocusManager {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface FocusManager {
method public void clearFocus(optional boolean force);
method public boolean moveFocus(int focusDirection);
}
@@ -1851,7 +1851,7 @@
property public abstract androidx.compose.ui.unit.LayoutDirection layoutDirection;
}
- public interface LayoutCoordinates {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface LayoutCoordinates {
method public operator int get(androidx.compose.ui.layout.AlignmentLine alignmentLine);
method public androidx.compose.ui.layout.LayoutCoordinates? getParentCoordinates();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentLayoutCoordinates();
@@ -2260,7 +2260,7 @@
property public final boolean showLayoutBounds;
}
- public interface AccessibilityManager {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface AccessibilityManager {
method public long calculateRecommendedTimeoutMillis(long originalTimeoutMillis, optional boolean containsIcons, optional boolean containsText, optional boolean containsControls);
}
@@ -2461,7 +2461,7 @@
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier testTag(androidx.compose.ui.Modifier, String tag);
}
- public interface TextToolbar {
+ @kotlin.jvm.JvmDefaultWithCompatibility public interface TextToolbar {
method public androidx.compose.ui.platform.TextToolbarStatus getStatus();
method public void hide();
method public void showMenu(androidx.compose.ui.geometry.Rect rect, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onCopyRequested, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onPasteRequested, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onCutRequested, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onSelectAllRequested);
@@ -3042,9 +3042,11 @@
method public boolean getDismissOnBackPress();
method public boolean getDismissOnClickOutside();
method public androidx.compose.ui.window.SecureFlagPolicy getSecurePolicy();
+ method public boolean getUsePlatformDefaultWidth();
property public final boolean dismissOnBackPress;
property public final boolean dismissOnClickOutside;
property public final androidx.compose.ui.window.SecureFlagPolicy securePolicy;
+ property public final boolean usePlatformDefaultWidth;
}
public interface DialogWindowProvider {
@@ -3064,12 +3066,14 @@
method public boolean getExcludeFromSystemGesture();
method public boolean getFocusable();
method public androidx.compose.ui.window.SecureFlagPolicy getSecurePolicy();
+ method public boolean getUsePlatformDefaultWidth();
property public final boolean clippingEnabled;
property public final boolean dismissOnBackPress;
property public final boolean dismissOnClickOutside;
property public final boolean excludeFromSystemGesture;
property public final boolean focusable;
property public final androidx.compose.ui.window.SecureFlagPolicy securePolicy;
+ property public final boolean usePlatformDefaultWidth;
}
public enum SecureFlagPolicy {
diff --git a/compose/ui/ui/build.gradle b/compose/ui/ui/build.gradle
index a2f5105..a5c8c94 100644
--- a/compose/ui/ui/build.gradle
+++ b/compose/ui/ui/build.gradle
@@ -40,8 +40,8 @@
implementation(libs.kotlinCoroutinesCore)
// when updating the runtime version please also update the runtime-saveable version
- implementation(project(":compose:runtime:runtime"))
- api(project(":compose:runtime:runtime-saveable"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
+ api("androidx.compose.runtime:runtime-saveable:1.2.0-rc01")
api(project(":compose:ui:ui-geometry"))
api(project(":compose:ui:ui-graphics"))
@@ -65,7 +65,7 @@
implementation("androidx.lifecycle:lifecycle-common-java8:2.3.0")
implementation("androidx.lifecycle:lifecycle-runtime:2.3.0")
implementation("androidx.lifecycle:lifecycle-viewmodel:2.3.0")
- implementation(project(":profileinstaller:profileinstaller"))
+ implementation("androidx.profileinstaller:profileinstaller:1.2.0-rc01")
testImplementation(libs.testRules)
testImplementation(libs.testRunner)
diff --git a/compose/ui/ui/samples/build.gradle b/compose/ui/ui/samples/build.gradle
index 4f202cc..6db2727 100644
--- a/compose/ui/ui/samples/build.gradle
+++ b/compose/ui/ui/samples/build.gradle
@@ -32,10 +32,10 @@
compileOnly(project(":annotation:annotation-sampled"))
- implementation(project(":compose:animation:animation-core"))
+ implementation("androidx.compose.animation:animation-core:1.2.0-rc01")
implementation("androidx.compose.foundation:foundation-layout:1.0.0")
implementation("androidx.compose.material:material:1.0.0")
- implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.runtime:runtime:1.2.0-rc01")
implementation(project(":compose:ui:ui"))
}
diff --git a/concurrent/concurrent-futures/api/restricted_current.txt b/concurrent/concurrent-futures/api/restricted_current.txt
index ccfd21d..22e80e1 100644
--- a/concurrent/concurrent-futures/api/restricted_current.txt
+++ b/concurrent/concurrent-futures/api/restricted_current.txt
@@ -35,10 +35,10 @@
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class ResolvableFuture<V> extends androidx.concurrent.futures.AbstractResolvableFuture<V> {
- method public static <V> androidx.concurrent.futures.ResolvableFuture<V!>! create();
+ method public static <V> androidx.concurrent.futures.ResolvableFuture<V!> create();
method public boolean set(V?);
- method public boolean setException(Throwable!);
- method public boolean setFuture(com.google.common.util.concurrent.ListenableFuture<? extends V>!);
+ method public boolean setException(Throwable);
+ method public boolean setFuture(com.google.common.util.concurrent.ListenableFuture<? extends V>);
}
}
diff --git a/concurrent/concurrent-futures/src/main/java/androidx/concurrent/futures/ResolvableFuture.java b/concurrent/concurrent-futures/src/main/java/androidx/concurrent/futures/ResolvableFuture.java
index f04dae9..d3bc366 100644
--- a/concurrent/concurrent-futures/src/main/java/androidx/concurrent/futures/ResolvableFuture.java
+++ b/concurrent/concurrent-futures/src/main/java/androidx/concurrent/futures/ResolvableFuture.java
@@ -17,6 +17,7 @@
package androidx.concurrent.futures;
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
@@ -41,6 +42,7 @@
* Creates a new {@code ResolvableFuture} that can be completed or cancelled by a later method
* call.
*/
+ @NonNull
public static <V> ResolvableFuture<V> create() {
return new ResolvableFuture<>();
}
@@ -51,12 +53,12 @@
}
@Override
- public boolean setException(Throwable throwable) {
+ public boolean setException(@NonNull Throwable throwable) {
return super.setException(throwable);
}
@Override
- public boolean setFuture(ListenableFuture<? extends V> future) {
+ public boolean setFuture(@NonNull ListenableFuture<? extends V> future) {
return super.setFuture(future);
}
diff --git a/coordinatorlayout/coordinatorlayout/src/androidTest/java/androidx/coordinatorlayout/widget/CoordinatorLayoutTouchEventTest.java b/coordinatorlayout/coordinatorlayout/src/androidTest/java/androidx/coordinatorlayout/widget/CoordinatorLayoutTouchEventTest.java
index ff7307e..9535979 100644
--- a/coordinatorlayout/coordinatorlayout/src/androidTest/java/androidx/coordinatorlayout/widget/CoordinatorLayoutTouchEventTest.java
+++ b/coordinatorlayout/coordinatorlayout/src/androidTest/java/androidx/coordinatorlayout/widget/CoordinatorLayoutTouchEventTest.java
@@ -29,6 +29,7 @@
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
+import android.os.Build;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.TouchDelegate;
@@ -558,7 +559,12 @@
@NonNull
@Override
public String toString() {
- return "MotionEvent#getAction() == " + MotionEvent.actionToString(mAction);
+ String message = "MotionEvent#getAction() == ";
+ if (Build.VERSION.SDK_INT >= 19) {
+ return message + MotionEvent.actionToString(mAction);
+ } else {
+ return message + mAction;
+ }
}
}
diff --git a/coordinatorlayout/coordinatorlayout/src/main/java/androidx/coordinatorlayout/widget/ViewGroupUtils.java b/coordinatorlayout/coordinatorlayout/src/main/java/androidx/coordinatorlayout/widget/ViewGroupUtils.java
index fc87dd2..e2afd11 100644
--- a/coordinatorlayout/coordinatorlayout/src/main/java/androidx/coordinatorlayout/widget/ViewGroupUtils.java
+++ b/coordinatorlayout/coordinatorlayout/src/main/java/androidx/coordinatorlayout/widget/ViewGroupUtils.java
@@ -25,6 +25,7 @@
import android.view.ViewGroup;
import android.view.ViewParent;
+import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
/**
@@ -73,7 +74,11 @@
* @param descendant descendant view to reference
* @param out rect to set to the bounds of the descendant view
*/
- public static void getDescendantRect(ViewGroup parent, View descendant, Rect out) {
+ public static void getDescendantRect(
+ @NonNull ViewGroup parent,
+ @NonNull View descendant,
+ @NonNull Rect out
+ ) {
out.set(0, 0, descendant.getWidth(), descendant.getHeight());
offsetDescendantRect(parent, descendant, out);
}
diff --git a/core/core/api/current.txt b/core/core/api/current.txt
index 4d7bf75..c02cb38 100644
--- a/core/core/api/current.txt
+++ b/core/core/api/current.txt
@@ -1578,11 +1578,14 @@
method public static int getGnssYearOfHardware(android.location.LocationManager);
method public static boolean hasProvider(android.location.LocationManager, String);
method public static boolean isLocationEnabled(android.location.LocationManager);
+ method @RequiresApi(android.os.Build.VERSION_CODES.N) @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssMeasurementsCallback(android.location.LocationManager, android.location.GnssMeasurementsEvent.Callback, android.os.Handler);
+ method @RequiresApi(android.os.Build.VERSION_CODES.R) @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssMeasurementsCallback(android.location.LocationManager, java.util.concurrent.Executor, android.location.GnssMeasurementsEvent.Callback);
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssStatusCallback(android.location.LocationManager, androidx.core.location.GnssStatusCompat.Callback, android.os.Handler);
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssStatusCallback(android.location.LocationManager, java.util.concurrent.Executor, androidx.core.location.GnssStatusCompat.Callback);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static void removeUpdates(android.location.LocationManager, androidx.core.location.LocationListenerCompat);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static void requestLocationUpdates(android.location.LocationManager, String, androidx.core.location.LocationRequestCompat, java.util.concurrent.Executor, androidx.core.location.LocationListenerCompat);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static void requestLocationUpdates(android.location.LocationManager, String, androidx.core.location.LocationRequestCompat, androidx.core.location.LocationListenerCompat, android.os.Looper);
+ method @RequiresApi(android.os.Build.VERSION_CODES.N) public static void unregisterGnssMeasurementsCallback(android.location.LocationManager, android.location.GnssMeasurementsEvent.Callback);
method public static void unregisterGnssStatusCallback(android.location.LocationManager, androidx.core.location.GnssStatusCompat.Callback);
}
diff --git a/core/core/api/public_plus_experimental_current.txt b/core/core/api/public_plus_experimental_current.txt
index e87726f..191403e 100644
--- a/core/core/api/public_plus_experimental_current.txt
+++ b/core/core/api/public_plus_experimental_current.txt
@@ -1578,11 +1578,14 @@
method public static int getGnssYearOfHardware(android.location.LocationManager);
method public static boolean hasProvider(android.location.LocationManager, String);
method public static boolean isLocationEnabled(android.location.LocationManager);
+ method @RequiresApi(android.os.Build.VERSION_CODES.N) @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssMeasurementsCallback(android.location.LocationManager, android.location.GnssMeasurementsEvent.Callback, android.os.Handler);
+ method @RequiresApi(android.os.Build.VERSION_CODES.R) @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssMeasurementsCallback(android.location.LocationManager, java.util.concurrent.Executor, android.location.GnssMeasurementsEvent.Callback);
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssStatusCallback(android.location.LocationManager, androidx.core.location.GnssStatusCompat.Callback, android.os.Handler);
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssStatusCallback(android.location.LocationManager, java.util.concurrent.Executor, androidx.core.location.GnssStatusCompat.Callback);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static void removeUpdates(android.location.LocationManager, androidx.core.location.LocationListenerCompat);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static void requestLocationUpdates(android.location.LocationManager, String, androidx.core.location.LocationRequestCompat, java.util.concurrent.Executor, androidx.core.location.LocationListenerCompat);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static void requestLocationUpdates(android.location.LocationManager, String, androidx.core.location.LocationRequestCompat, androidx.core.location.LocationListenerCompat, android.os.Looper);
+ method @RequiresApi(android.os.Build.VERSION_CODES.N) public static void unregisterGnssMeasurementsCallback(android.location.LocationManager, android.location.GnssMeasurementsEvent.Callback);
method public static void unregisterGnssStatusCallback(android.location.LocationManager, androidx.core.location.GnssStatusCompat.Callback);
}
diff --git a/core/core/api/restricted_current.txt b/core/core/api/restricted_current.txt
index 1168b22..3a6cb54 100644
--- a/core/core/api/restricted_current.txt
+++ b/core/core/api/restricted_current.txt
@@ -1909,11 +1909,14 @@
method public static int getGnssYearOfHardware(android.location.LocationManager);
method public static boolean hasProvider(android.location.LocationManager, String);
method public static boolean isLocationEnabled(android.location.LocationManager);
+ method @RequiresApi(android.os.Build.VERSION_CODES.N) @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssMeasurementsCallback(android.location.LocationManager, android.location.GnssMeasurementsEvent.Callback, android.os.Handler);
+ method @RequiresApi(android.os.Build.VERSION_CODES.R) @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssMeasurementsCallback(android.location.LocationManager, java.util.concurrent.Executor, android.location.GnssMeasurementsEvent.Callback);
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssStatusCallback(android.location.LocationManager, androidx.core.location.GnssStatusCompat.Callback, android.os.Handler);
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static boolean registerGnssStatusCallback(android.location.LocationManager, java.util.concurrent.Executor, androidx.core.location.GnssStatusCompat.Callback);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static void removeUpdates(android.location.LocationManager, androidx.core.location.LocationListenerCompat);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static void requestLocationUpdates(android.location.LocationManager, String, androidx.core.location.LocationRequestCompat, java.util.concurrent.Executor, androidx.core.location.LocationListenerCompat);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static void requestLocationUpdates(android.location.LocationManager, String, androidx.core.location.LocationRequestCompat, androidx.core.location.LocationListenerCompat, android.os.Looper);
+ method @RequiresApi(android.os.Build.VERSION_CODES.N) public static void unregisterGnssMeasurementsCallback(android.location.LocationManager, android.location.GnssMeasurementsEvent.Callback);
method public static void unregisterGnssStatusCallback(android.location.LocationManager, androidx.core.location.GnssStatusCompat.Callback);
}
diff --git a/core/core/src/androidTest/java/androidx/core/location/LocationManagerCompatTest.java b/core/core/src/androidTest/java/androidx/core/location/LocationManagerCompatTest.java
index 17a6041..baa23f5 100644
--- a/core/core/src/androidTest/java/androidx/core/location/LocationManagerCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/location/LocationManagerCompatTest.java
@@ -25,6 +25,7 @@
import static org.junit.Assert.assertTrue;
import android.content.Context;
+import android.location.GnssMeasurementsEvent;
import android.location.LocationManager;
import android.os.Build;
import android.os.Handler;
@@ -35,6 +36,7 @@
import androidx.core.os.CancellationSignal;
import androidx.core.os.ExecutorCompat;
import androidx.test.core.app.ApplicationProvider;
+import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
import org.junit.Before;
@@ -145,4 +147,21 @@
// can't do much to test this except check it doesn't crash
assertTrue(LocationManagerCompat.getGnssYearOfHardware(mLocationManager) >= 0);
}
+
+ @SdkSuppress(minSdkVersion = 24)
+ @Test
+ public void testRegisterGnssMeasurementsCallback_handler() {
+ // can't do much to test this except check it doesn't crash
+ assertTrue(LocationManagerCompat.registerGnssMeasurementsCallback(mLocationManager,
+ new GnssMeasurementsEvent.Callback() {}, new Handler(Looper.getMainLooper())));
+ }
+
+ @SdkSuppress(minSdkVersion = 30)
+ @Test
+ public void testRegisterGnssMeasurementsCallback_executor() {
+ // can't do much to test this except check it doesn't crash
+ assertTrue(LocationManagerCompat.registerGnssMeasurementsCallback(mLocationManager,
+ Runnable::run,
+ new GnssMeasurementsEvent.Callback() {}));
+ }
}
diff --git a/core/core/src/main/java/androidx/core/location/LocationManagerCompat.java b/core/core/src/main/java/androidx/core/location/LocationManagerCompat.java
index 3f04d30..118b873 100644
--- a/core/core/src/main/java/androidx/core/location/LocationManagerCompat.java
+++ b/core/core/src/main/java/androidx/core/location/LocationManagerCompat.java
@@ -28,6 +28,7 @@
import android.annotation.SuppressLint;
import android.content.Context;
+import android.location.GnssMeasurementsEvent;
import android.location.GnssStatus;
import android.location.GpsStatus;
import android.location.Location;
@@ -81,6 +82,9 @@
private static final long PRE_N_LOOPER_TIMEOUT_S = 5;
private static Field sContextField;
+ private static Class<?> sGnssRequestBuilderClass;
+ private static Method sGnssRequestBuilderBuildMethod;
+ private static Method sRegisterGnssMeasurementsCallbackMethod;
/**
* Returns the current enabled/disabled state of location.
@@ -366,13 +370,107 @@
}
// allows lazy instantiation since most processes do not use GNSS APIs
- private static class GnssLazyLoader {
+ private static class GnssListenersHolder {
@GuardedBy("sGnssStatusListeners")
static final SimpleArrayMap<Object, Object> sGnssStatusListeners =
new SimpleArrayMap<>();
}
/**
+ * Registers a GNSS measurement callback. See
+ * {@link LocationManager#registerGnssMeasurementsCallback(GnssMeasurementsEvent.Callback, Handler)}.
+ *
+ * <p>The primary purpose for this compatibility method is to help avoid crashes when delivering
+ * GNSS measurements to client on Android R. This bug was fixed in Android R QPR1, but since
+ * it's possible not all Android R devices have upgraded to QPR1, this compatibility method is
+ * provided to ensure GNSS measurements can be delivered successfully on all platforms.
+ */
+ @RequiresApi(VERSION_CODES.N)
+ @RequiresPermission(ACCESS_FINE_LOCATION)
+ public static boolean registerGnssMeasurementsCallback(@NonNull LocationManager locationManager,
+ @NonNull GnssMeasurementsEvent.Callback callback, @NonNull Handler handler) {
+ if (VERSION.SDK_INT != VERSION_CODES.R) {
+ return Api24Impl.registerGnssMeasurementsCallback(locationManager, callback, handler);
+ } else {
+ return registerGnssMeasurementsCallbackOnR(locationManager,
+ ExecutorCompat.create(handler),
+ callback);
+ }
+ }
+
+ /**
+ * Registers a GNSS measurement callback. See
+ * {@link LocationManager#registerGnssMeasurementsCallback(Executor, GnssMeasurementsEvent.Callback)}.
+ *
+ * <p>The primary purpose for this compatibility method is to help avoid crashes when delivering
+ * GNSS measurements to client on Android R. This bug was fixed in Android R QPR1, but since
+ * it's possible not all Android R devices have upgraded to QPR1, this compatibility method is
+ * provided to ensure GNSS measurements can be delivered successfully on all platforms.
+ */
+ @RequiresApi(VERSION_CODES.R)
+ @RequiresPermission(ACCESS_FINE_LOCATION)
+ public static boolean registerGnssMeasurementsCallback(@NonNull LocationManager locationManager,
+ @NonNull Executor executor, @NonNull GnssMeasurementsEvent.Callback callback) {
+ if (VERSION.SDK_INT > VERSION_CODES.R) {
+ return Api31Impl.registerGnssMeasurementsCallback(locationManager, executor, callback);
+ } else {
+ return registerGnssMeasurementsCallbackOnR(locationManager,
+ executor,
+ callback);
+ }
+ }
+
+ /**
+ * Unregisters a GNSS measurement callback. See
+ * {@link LocationManager#unregisterGnssMeasurementsCallback(GnssMeasurementsEvent.Callback)}.
+ */
+ @RequiresApi(VERSION_CODES.N)
+ public static void unregisterGnssMeasurementsCallback(@NonNull LocationManager locationManager,
+ @NonNull GnssMeasurementsEvent.Callback callback) {
+ Api24Impl.unregisterGnssMeasurementsCallback(locationManager, callback);
+ }
+
+ // Android R without QPR1 has a bug where the default version of this method will always
+ // cause crashes. Reflect to invoke the SystemApi version instead, which avoids this.
+ @RequiresApi(VERSION_CODES.R)
+ private static boolean registerGnssMeasurementsCallbackOnR(
+ @NonNull LocationManager locationManager, @NonNull Executor executor,
+ @NonNull GnssMeasurementsEvent.Callback callback) {
+ if (VERSION.SDK_INT == VERSION_CODES.R) {
+ try {
+ if (sGnssRequestBuilderClass == null) {
+ sGnssRequestBuilderClass = Class.forName(
+ "android.location.GnssRequest$Builder");
+ }
+ if (sGnssRequestBuilderBuildMethod == null) {
+ sGnssRequestBuilderBuildMethod = sGnssRequestBuilderClass.getDeclaredMethod(
+ "build");
+ sGnssRequestBuilderBuildMethod.setAccessible(true);
+ }
+ if (sRegisterGnssMeasurementsCallbackMethod == null) {
+ sRegisterGnssMeasurementsCallbackMethod =
+ LocationManager.class.getDeclaredMethod(
+ "registerGnssMeasurementsCallback",
+ Class.forName("android.location.GnssRequest"), Executor.class,
+ GnssMeasurementsEvent.Callback.class);
+ sRegisterGnssMeasurementsCallbackMethod.setAccessible(true);
+ }
+
+ Object success = sRegisterGnssMeasurementsCallbackMethod.invoke(locationManager,
+ sGnssRequestBuilderBuildMethod.invoke(
+ sGnssRequestBuilderClass.getDeclaredConstructor().newInstance()),
+ executor, callback);
+ return success != null && (boolean) success;
+ } catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException
+ | IllegalAccessException | InstantiationException e) {
+ return false;
+ }
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ /**
* Registers a platform agnostic {@link GnssStatusCompat.Callback}. See
* {@link LocationManager#addGpsStatusListener(GpsStatus.Listener)} and
* {@link LocationManager#registerGnssStatusCallback(GnssStatus.Callback, Handler)}.
@@ -435,9 +533,9 @@
locationManager, baseHandler, executor, callback);
} else {
Preconditions.checkArgument(baseHandler != null);
- synchronized (GnssLazyLoader.sGnssStatusListeners) {
+ synchronized (GnssListenersHolder.sGnssStatusListeners) {
GpsStatusTransport transport =
- (GpsStatusTransport) GnssLazyLoader.sGnssStatusListeners.get(callback);
+ (GpsStatusTransport) GnssListenersHolder.sGnssStatusListeners.get(callback);
if (transport == null) {
transport = new GpsStatusTransport(locationManager, callback);
} else {
@@ -462,7 +560,7 @@
while (true) {
try {
if (task.get(remainingNanos, NANOSECONDS)) {
- GnssLazyLoader.sGnssStatusListeners.put(callback, myTransport);
+ GnssListenersHolder.sGnssStatusListeners.put(callback, myTransport);
return true;
} else {
return false;
@@ -502,16 +600,17 @@
public static void unregisterGnssStatusCallback(@NonNull LocationManager locationManager,
@NonNull GnssStatusCompat.Callback callback) {
if (VERSION.SDK_INT >= 24) {
- synchronized (GnssLazyLoader.sGnssStatusListeners) {
- Object transport = GnssLazyLoader.sGnssStatusListeners.remove(callback);
+ synchronized (GnssListenersHolder.sGnssStatusListeners) {
+ Object transport = GnssListenersHolder.sGnssStatusListeners.remove(callback);
if (transport != null) {
Api24Impl.unregisterGnssStatusCallback(locationManager, transport);
}
}
} else {
- synchronized (GnssLazyLoader.sGnssStatusListeners) {
+ synchronized (GnssListenersHolder.sGnssStatusListeners) {
GpsStatusTransport transport =
- (GpsStatusTransport) GnssLazyLoader.sGnssStatusListeners.remove(callback);
+ (GpsStatusTransport) GnssListenersHolder.sGnssStatusListeners.remove(
+ callback);
if (transport != null) {
transport.unregister();
locationManager.removeGpsStatusListener(transport);
@@ -988,6 +1087,13 @@
@NonNull Executor executor, @NonNull LocationListener listener) {
locationManager.requestLocationUpdates(provider, locationRequest, executor, listener);
}
+
+ @RequiresPermission(ACCESS_FINE_LOCATION)
+ @DoNotInline
+ static boolean registerGnssMeasurementsCallback(@NonNull LocationManager locationManager,
+ @NonNull Executor executor, @NonNull GnssMeasurementsEvent.Callback callback) {
+ return locationManager.registerGnssMeasurementsCallback(executor, callback);
+ }
}
@RequiresApi(30)
@@ -1054,14 +1160,15 @@
@DoNotInline
public static boolean registerGnssStatusCallback(LocationManager locationManager,
Handler baseHandler, Executor executor, GnssStatusCompat.Callback callback) {
- synchronized (GnssLazyLoader.sGnssStatusListeners) {
+ synchronized (GnssListenersHolder.sGnssStatusListeners) {
GnssStatusTransport transport =
- (GnssStatusTransport) GnssLazyLoader.sGnssStatusListeners.get(callback);
+ (GnssStatusTransport) GnssListenersHolder.sGnssStatusListeners.get(
+ callback);
if (transport == null) {
transport = new GnssStatusTransport(callback);
}
if (locationManager.registerGnssStatusCallback(executor, transport)) {
- GnssLazyLoader.sGnssStatusListeners.put(callback, transport);
+ GnssListenersHolder.sGnssStatusListeners.put(callback, transport);
return true;
} else {
return false;
@@ -1185,15 +1292,29 @@
// This class is not instantiable.
}
+ @RequiresPermission(ACCESS_FINE_LOCATION)
+ @DoNotInline
+ static boolean registerGnssMeasurementsCallback(@NonNull LocationManager locationManager,
+ @NonNull GnssMeasurementsEvent.Callback callback, @NonNull Handler handler) {
+ return locationManager.registerGnssMeasurementsCallback(callback, handler);
+ }
+
+ @DoNotInline
+ static void unregisterGnssMeasurementsCallback(@NonNull LocationManager locationManager,
+ @NonNull GnssMeasurementsEvent.Callback callback) {
+ locationManager.unregisterGnssMeasurementsCallback(callback);
+ }
+
@RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
@DoNotInline
static boolean registerGnssStatusCallback(LocationManager locationManager,
Handler baseHandler, Executor executor, GnssStatusCompat.Callback callback) {
Preconditions.checkArgument(baseHandler != null);
- synchronized (GnssLazyLoader.sGnssStatusListeners) {
+ synchronized (GnssListenersHolder.sGnssStatusListeners) {
PreRGnssStatusTransport transport =
- (PreRGnssStatusTransport) GnssLazyLoader.sGnssStatusListeners.get(callback);
+ (PreRGnssStatusTransport) GnssListenersHolder.sGnssStatusListeners.get(
+ callback);
if (transport == null) {
transport = new PreRGnssStatusTransport(callback);
} else {
@@ -1202,7 +1323,7 @@
transport.register(executor);
if (locationManager.registerGnssStatusCallback(transport, baseHandler)) {
- GnssLazyLoader.sGnssStatusListeners.put(callback, transport);
+ GnssListenersHolder.sGnssStatusListeners.put(callback, transport);
return true;
} else {
return false;
diff --git a/core/uwb/uwb-rxjava3/build.gradle b/core/uwb/uwb-rxjava3/build.gradle
index eeb17b36..93b70fa 100644
--- a/core/uwb/uwb-rxjava3/build.gradle
+++ b/core/uwb/uwb-rxjava3/build.gradle
@@ -26,7 +26,7 @@
api(libs.kotlinStdlib)
api(libs.rxjava3)
api(libs.kotlinCoroutinesRx3)
- api(project(":core:uwb:uwb"))
+ implementation("androidx.core.uwb:uwb:1.0.0-alpha02")
androidTestImplementation(libs.kotlinStdlib)
androidTestImplementation(libs.testExtJunit)
diff --git a/cursoradapter/cursoradapter/api/current.txt b/cursoradapter/cursoradapter/api/current.txt
index 3cc7587..0d6024a 100644
--- a/cursoradapter/cursoradapter/api/current.txt
+++ b/cursoradapter/cursoradapter/api/current.txt
@@ -3,25 +3,25 @@
public abstract class CursorAdapter extends android.widget.BaseAdapter implements android.widget.Filterable {
ctor @Deprecated public CursorAdapter(android.content.Context!, android.database.Cursor!);
- ctor public CursorAdapter(android.content.Context!, android.database.Cursor!, boolean);
- ctor public CursorAdapter(android.content.Context!, android.database.Cursor!, int);
- method public abstract void bindView(android.view.View!, android.content.Context!, android.database.Cursor!);
- method public void changeCursor(android.database.Cursor!);
- method public CharSequence! convertToString(android.database.Cursor!);
+ ctor public CursorAdapter(android.content.Context, android.database.Cursor?, boolean);
+ ctor public CursorAdapter(android.content.Context, android.database.Cursor?, int);
+ method public abstract void bindView(android.view.View, android.content.Context, android.database.Cursor);
+ method public void changeCursor(android.database.Cursor?);
+ method public CharSequence convertToString(android.database.Cursor?);
method public int getCount();
- method public android.database.Cursor! getCursor();
+ method public android.database.Cursor? getCursor();
method public android.widget.Filter! getFilter();
- method public android.widget.FilterQueryProvider! getFilterQueryProvider();
+ method public android.widget.FilterQueryProvider? getFilterQueryProvider();
method public Object! getItem(int);
method public long getItemId(int);
method public android.view.View! getView(int, android.view.View!, android.view.ViewGroup!);
method @Deprecated protected void init(android.content.Context!, android.database.Cursor!, boolean);
- method public android.view.View! newDropDownView(android.content.Context!, android.database.Cursor!, android.view.ViewGroup!);
- method public abstract android.view.View! newView(android.content.Context!, android.database.Cursor!, android.view.ViewGroup!);
+ method public android.view.View newDropDownView(android.content.Context, android.database.Cursor, android.view.ViewGroup?);
+ method public abstract android.view.View newView(android.content.Context, android.database.Cursor, android.view.ViewGroup?);
method protected void onContentChanged();
- method public android.database.Cursor! runQueryOnBackgroundThread(CharSequence!);
- method public void setFilterQueryProvider(android.widget.FilterQueryProvider!);
- method public android.database.Cursor! swapCursor(android.database.Cursor!);
+ method public android.database.Cursor? runQueryOnBackgroundThread(CharSequence?);
+ method public void setFilterQueryProvider(android.widget.FilterQueryProvider?);
+ method public android.database.Cursor? swapCursor(android.database.Cursor?);
field @Deprecated public static final int FLAG_AUTO_REQUERY = 1; // 0x1
field public static final int FLAG_REGISTER_CONTENT_OBSERVER = 2; // 0x2
}
@@ -29,33 +29,33 @@
public abstract class ResourceCursorAdapter extends androidx.cursoradapter.widget.CursorAdapter {
ctor @Deprecated public ResourceCursorAdapter(android.content.Context!, int, android.database.Cursor!);
ctor @Deprecated public ResourceCursorAdapter(android.content.Context!, int, android.database.Cursor!, boolean);
- ctor public ResourceCursorAdapter(android.content.Context!, int, android.database.Cursor!, int);
- method public android.view.View! newView(android.content.Context!, android.database.Cursor!, android.view.ViewGroup!);
+ ctor public ResourceCursorAdapter(android.content.Context, int, android.database.Cursor?, int);
+ method public android.view.View newView(android.content.Context, android.database.Cursor?, android.view.ViewGroup?);
method public void setDropDownViewResource(int);
method public void setViewResource(int);
}
public class SimpleCursorAdapter extends androidx.cursoradapter.widget.ResourceCursorAdapter {
- ctor @Deprecated public SimpleCursorAdapter(android.content.Context!, int, android.database.Cursor!, String![]!, int[]!);
- ctor public SimpleCursorAdapter(android.content.Context!, int, android.database.Cursor!, String![]!, int[]!, int);
- method public void bindView(android.view.View!, android.content.Context!, android.database.Cursor!);
- method public void changeCursorAndColumns(android.database.Cursor!, String![]!, int[]!);
- method public androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter! getCursorToStringConverter();
+ ctor @Deprecated public SimpleCursorAdapter(android.content.Context, int, android.database.Cursor?, String![]?, int[]?);
+ ctor public SimpleCursorAdapter(android.content.Context, int, android.database.Cursor?, String![]?, int[]?, int);
+ method public void bindView(android.view.View, android.content.Context, android.database.Cursor);
+ method public void changeCursorAndColumns(android.database.Cursor?, String![]?, int[]?);
+ method public androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter? getCursorToStringConverter();
method public int getStringConversionColumn();
- method public androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder! getViewBinder();
- method public void setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter!);
+ method public androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder? getViewBinder();
+ method public void setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter?);
method public void setStringConversionColumn(int);
- method public void setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder!);
- method public void setViewImage(android.widget.ImageView!, String!);
- method public void setViewText(android.widget.TextView!, String!);
+ method public void setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder?);
+ method public void setViewImage(android.widget.ImageView, String);
+ method public void setViewText(android.widget.TextView, String);
}
public static interface SimpleCursorAdapter.CursorToStringConverter {
- method public CharSequence! convertToString(android.database.Cursor!);
+ method public CharSequence convertToString(android.database.Cursor?);
}
public static interface SimpleCursorAdapter.ViewBinder {
- method public boolean setViewValue(android.view.View!, android.database.Cursor!, int);
+ method public boolean setViewValue(android.view.View, android.database.Cursor, int);
}
}
diff --git a/cursoradapter/cursoradapter/api/public_plus_experimental_current.txt b/cursoradapter/cursoradapter/api/public_plus_experimental_current.txt
index 3cc7587..0d6024a 100644
--- a/cursoradapter/cursoradapter/api/public_plus_experimental_current.txt
+++ b/cursoradapter/cursoradapter/api/public_plus_experimental_current.txt
@@ -3,25 +3,25 @@
public abstract class CursorAdapter extends android.widget.BaseAdapter implements android.widget.Filterable {
ctor @Deprecated public CursorAdapter(android.content.Context!, android.database.Cursor!);
- ctor public CursorAdapter(android.content.Context!, android.database.Cursor!, boolean);
- ctor public CursorAdapter(android.content.Context!, android.database.Cursor!, int);
- method public abstract void bindView(android.view.View!, android.content.Context!, android.database.Cursor!);
- method public void changeCursor(android.database.Cursor!);
- method public CharSequence! convertToString(android.database.Cursor!);
+ ctor public CursorAdapter(android.content.Context, android.database.Cursor?, boolean);
+ ctor public CursorAdapter(android.content.Context, android.database.Cursor?, int);
+ method public abstract void bindView(android.view.View, android.content.Context, android.database.Cursor);
+ method public void changeCursor(android.database.Cursor?);
+ method public CharSequence convertToString(android.database.Cursor?);
method public int getCount();
- method public android.database.Cursor! getCursor();
+ method public android.database.Cursor? getCursor();
method public android.widget.Filter! getFilter();
- method public android.widget.FilterQueryProvider! getFilterQueryProvider();
+ method public android.widget.FilterQueryProvider? getFilterQueryProvider();
method public Object! getItem(int);
method public long getItemId(int);
method public android.view.View! getView(int, android.view.View!, android.view.ViewGroup!);
method @Deprecated protected void init(android.content.Context!, android.database.Cursor!, boolean);
- method public android.view.View! newDropDownView(android.content.Context!, android.database.Cursor!, android.view.ViewGroup!);
- method public abstract android.view.View! newView(android.content.Context!, android.database.Cursor!, android.view.ViewGroup!);
+ method public android.view.View newDropDownView(android.content.Context, android.database.Cursor, android.view.ViewGroup?);
+ method public abstract android.view.View newView(android.content.Context, android.database.Cursor, android.view.ViewGroup?);
method protected void onContentChanged();
- method public android.database.Cursor! runQueryOnBackgroundThread(CharSequence!);
- method public void setFilterQueryProvider(android.widget.FilterQueryProvider!);
- method public android.database.Cursor! swapCursor(android.database.Cursor!);
+ method public android.database.Cursor? runQueryOnBackgroundThread(CharSequence?);
+ method public void setFilterQueryProvider(android.widget.FilterQueryProvider?);
+ method public android.database.Cursor? swapCursor(android.database.Cursor?);
field @Deprecated public static final int FLAG_AUTO_REQUERY = 1; // 0x1
field public static final int FLAG_REGISTER_CONTENT_OBSERVER = 2; // 0x2
}
@@ -29,33 +29,33 @@
public abstract class ResourceCursorAdapter extends androidx.cursoradapter.widget.CursorAdapter {
ctor @Deprecated public ResourceCursorAdapter(android.content.Context!, int, android.database.Cursor!);
ctor @Deprecated public ResourceCursorAdapter(android.content.Context!, int, android.database.Cursor!, boolean);
- ctor public ResourceCursorAdapter(android.content.Context!, int, android.database.Cursor!, int);
- method public android.view.View! newView(android.content.Context!, android.database.Cursor!, android.view.ViewGroup!);
+ ctor public ResourceCursorAdapter(android.content.Context, int, android.database.Cursor?, int);
+ method public android.view.View newView(android.content.Context, android.database.Cursor?, android.view.ViewGroup?);
method public void setDropDownViewResource(int);
method public void setViewResource(int);
}
public class SimpleCursorAdapter extends androidx.cursoradapter.widget.ResourceCursorAdapter {
- ctor @Deprecated public SimpleCursorAdapter(android.content.Context!, int, android.database.Cursor!, String![]!, int[]!);
- ctor public SimpleCursorAdapter(android.content.Context!, int, android.database.Cursor!, String![]!, int[]!, int);
- method public void bindView(android.view.View!, android.content.Context!, android.database.Cursor!);
- method public void changeCursorAndColumns(android.database.Cursor!, String![]!, int[]!);
- method public androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter! getCursorToStringConverter();
+ ctor @Deprecated public SimpleCursorAdapter(android.content.Context, int, android.database.Cursor?, String![]?, int[]?);
+ ctor public SimpleCursorAdapter(android.content.Context, int, android.database.Cursor?, String![]?, int[]?, int);
+ method public void bindView(android.view.View, android.content.Context, android.database.Cursor);
+ method public void changeCursorAndColumns(android.database.Cursor?, String![]?, int[]?);
+ method public androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter? getCursorToStringConverter();
method public int getStringConversionColumn();
- method public androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder! getViewBinder();
- method public void setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter!);
+ method public androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder? getViewBinder();
+ method public void setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter?);
method public void setStringConversionColumn(int);
- method public void setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder!);
- method public void setViewImage(android.widget.ImageView!, String!);
- method public void setViewText(android.widget.TextView!, String!);
+ method public void setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder?);
+ method public void setViewImage(android.widget.ImageView, String);
+ method public void setViewText(android.widget.TextView, String);
}
public static interface SimpleCursorAdapter.CursorToStringConverter {
- method public CharSequence! convertToString(android.database.Cursor!);
+ method public CharSequence convertToString(android.database.Cursor?);
}
public static interface SimpleCursorAdapter.ViewBinder {
- method public boolean setViewValue(android.view.View!, android.database.Cursor!, int);
+ method public boolean setViewValue(android.view.View, android.database.Cursor, int);
}
}
diff --git a/cursoradapter/cursoradapter/api/restricted_current.txt b/cursoradapter/cursoradapter/api/restricted_current.txt
index 4d0bfcd..ef0a2e4 100644
--- a/cursoradapter/cursoradapter/api/restricted_current.txt
+++ b/cursoradapter/cursoradapter/api/restricted_current.txt
@@ -3,25 +3,25 @@
public abstract class CursorAdapter extends android.widget.BaseAdapter implements android.widget.Filterable {
ctor @Deprecated public CursorAdapter(android.content.Context!, android.database.Cursor!);
- ctor public CursorAdapter(android.content.Context!, android.database.Cursor!, boolean);
- ctor public CursorAdapter(android.content.Context!, android.database.Cursor!, int);
- method public abstract void bindView(android.view.View!, android.content.Context!, android.database.Cursor!);
- method public void changeCursor(android.database.Cursor!);
- method public CharSequence! convertToString(android.database.Cursor!);
+ ctor public CursorAdapter(android.content.Context, android.database.Cursor?, boolean);
+ ctor public CursorAdapter(android.content.Context, android.database.Cursor?, int);
+ method public abstract void bindView(android.view.View, android.content.Context, android.database.Cursor);
+ method public void changeCursor(android.database.Cursor?);
+ method public CharSequence convertToString(android.database.Cursor?);
method public int getCount();
- method public android.database.Cursor! getCursor();
+ method public android.database.Cursor? getCursor();
method public android.widget.Filter! getFilter();
- method public android.widget.FilterQueryProvider! getFilterQueryProvider();
+ method public android.widget.FilterQueryProvider? getFilterQueryProvider();
method public Object! getItem(int);
method public long getItemId(int);
method public android.view.View! getView(int, android.view.View!, android.view.ViewGroup!);
method @Deprecated protected void init(android.content.Context!, android.database.Cursor!, boolean);
- method public android.view.View! newDropDownView(android.content.Context!, android.database.Cursor!, android.view.ViewGroup!);
- method public abstract android.view.View! newView(android.content.Context!, android.database.Cursor!, android.view.ViewGroup!);
+ method public android.view.View newDropDownView(android.content.Context, android.database.Cursor, android.view.ViewGroup?);
+ method public abstract android.view.View newView(android.content.Context, android.database.Cursor, android.view.ViewGroup?);
method protected void onContentChanged();
- method public android.database.Cursor! runQueryOnBackgroundThread(CharSequence!);
- method public void setFilterQueryProvider(android.widget.FilterQueryProvider!);
- method public android.database.Cursor! swapCursor(android.database.Cursor!);
+ method public android.database.Cursor? runQueryOnBackgroundThread(CharSequence?);
+ method public void setFilterQueryProvider(android.widget.FilterQueryProvider?);
+ method public android.database.Cursor? swapCursor(android.database.Cursor?);
field @Deprecated public static final int FLAG_AUTO_REQUERY = 1; // 0x1
field public static final int FLAG_REGISTER_CONTENT_OBSERVER = 2; // 0x2
}
@@ -29,35 +29,35 @@
public abstract class ResourceCursorAdapter extends androidx.cursoradapter.widget.CursorAdapter {
ctor @Deprecated public ResourceCursorAdapter(android.content.Context!, int, android.database.Cursor!);
ctor @Deprecated public ResourceCursorAdapter(android.content.Context!, int, android.database.Cursor!, boolean);
- ctor public ResourceCursorAdapter(android.content.Context!, int, android.database.Cursor!, int);
- method public android.view.View! newView(android.content.Context!, android.database.Cursor!, android.view.ViewGroup!);
+ ctor public ResourceCursorAdapter(android.content.Context, int, android.database.Cursor?, int);
+ method public android.view.View newView(android.content.Context, android.database.Cursor?, android.view.ViewGroup?);
method public void setDropDownViewResource(int);
method public void setViewResource(int);
}
public class SimpleCursorAdapter extends androidx.cursoradapter.widget.ResourceCursorAdapter {
- ctor @Deprecated public SimpleCursorAdapter(android.content.Context!, int, android.database.Cursor!, String![]!, int[]!);
- ctor public SimpleCursorAdapter(android.content.Context!, int, android.database.Cursor!, String![]!, int[]!, int);
- method public void bindView(android.view.View!, android.content.Context!, android.database.Cursor!);
- method public void changeCursorAndColumns(android.database.Cursor!, String![]!, int[]!);
- method public androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter! getCursorToStringConverter();
+ ctor @Deprecated public SimpleCursorAdapter(android.content.Context, int, android.database.Cursor?, String![]?, int[]?);
+ ctor public SimpleCursorAdapter(android.content.Context, int, android.database.Cursor?, String![]?, int[]?, int);
+ method public void bindView(android.view.View, android.content.Context, android.database.Cursor);
+ method public void changeCursorAndColumns(android.database.Cursor?, String![]?, int[]?);
+ method public androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter? getCursorToStringConverter();
method public int getStringConversionColumn();
- method public androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder! getViewBinder();
- method public void setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter!);
+ method public androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder? getViewBinder();
+ method public void setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter?);
method public void setStringConversionColumn(int);
- method public void setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder!);
- method public void setViewImage(android.widget.ImageView!, String!);
- method public void setViewText(android.widget.TextView!, String!);
- field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) protected int[]! mFrom;
- field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) protected int[]! mTo;
+ method public void setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder?);
+ method public void setViewImage(android.widget.ImageView, String);
+ method public void setViewText(android.widget.TextView, String);
+ field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) protected int[]? mFrom;
+ field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) protected int[]? mTo;
}
public static interface SimpleCursorAdapter.CursorToStringConverter {
- method public CharSequence! convertToString(android.database.Cursor!);
+ method public CharSequence convertToString(android.database.Cursor?);
}
public static interface SimpleCursorAdapter.ViewBinder {
- method public boolean setViewValue(android.view.View!, android.database.Cursor!, int);
+ method public boolean setViewValue(android.view.View, android.database.Cursor, int);
}
}
diff --git a/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/CursorAdapter.java b/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/CursorAdapter.java
index 2df3961..8ab70e5 100644
--- a/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/CursorAdapter.java
+++ b/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/CursorAdapter.java
@@ -29,6 +29,9 @@
import android.widget.FilterQueryProvider;
import android.widget.Filterable;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
/**
* Static library support version of the framework's {@link android.widget.CursorAdapter}.
* Used to write apps that run on platforms prior to Android 3.0. When running
@@ -101,7 +104,7 @@
* data is always displayed. Using true here is discouraged.
*/
@SuppressWarnings("deprecation")
- public CursorAdapter(Context context, Cursor c, boolean autoRequery) {
+ public CursorAdapter(@NonNull Context context, @Nullable Cursor c, boolean autoRequery) {
init(context, c, autoRequery ? FLAG_AUTO_REQUERY : FLAG_REGISTER_CONTENT_OBSERVER);
}
@@ -114,7 +117,7 @@
* be any combination of {@link #FLAG_AUTO_REQUERY} and
* {@link #FLAG_REGISTER_CONTENT_OBSERVER}.
*/
- public CursorAdapter(Context context, Cursor c, int flags) {
+ public CursorAdapter(@NonNull Context context, @Nullable Cursor c, int flags) {
init(context, c, flags);
}
@@ -129,7 +132,7 @@
}
@SuppressWarnings("deprecation")
- void init(Context context, Cursor c, int flags) {
+ void init(@NonNull Context context, @Nullable Cursor c, int flags) {
// Maintained for compatibility.
if ((flags & FLAG_AUTO_REQUERY) == FLAG_AUTO_REQUERY) {
flags |= FLAG_REGISTER_CONTENT_OBSERVER;
@@ -137,11 +140,11 @@
} else {
mAutoRequery = false;
}
- boolean cursorPresent = c != null;
mCursor = c;
+ boolean cursorPresent = mCursor != null;
mDataValid = cursorPresent;
mContext = context;
- mRowIDColumn = cursorPresent ? c.getColumnIndexOrThrow("_id") : -1;
+ mRowIDColumn = cursorPresent ? mCursor.getColumnIndexOrThrow("_id") : -1;
if ((flags & FLAG_REGISTER_CONTENT_OBSERVER) == FLAG_REGISTER_CONTENT_OBSERVER) {
mChangeObserver = new ChangeObserver();
mDataSetObserver = new MyDataSetObserver();
@@ -151,8 +154,8 @@
}
if (cursorPresent) {
- if (mChangeObserver != null) c.registerContentObserver(mChangeObserver);
- if (mDataSetObserver != null) c.registerDataSetObserver(mDataSetObserver);
+ if (mChangeObserver != null) mCursor.registerContentObserver(mChangeObserver);
+ if (mDataSetObserver != null) mCursor.registerDataSetObserver(mDataSetObserver);
}
}
@@ -161,7 +164,7 @@
* @return the cursor.
*/
@Override
- public Cursor getCursor() {
+ public @Nullable Cursor getCursor() {
return mCursor;
}
@@ -219,6 +222,10 @@
if (!mDataValid) {
throw new IllegalStateException("this should only be called when the cursor is valid");
}
+ if (mCursor == null) {
+ throw new IllegalStateException("this should only be called when the cursor is "
+ + "non-null");
+ }
if (!mCursor.moveToPosition(position)) {
throw new IllegalStateException("couldn't move cursor to position " + position);
}
@@ -234,7 +241,7 @@
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
- if (mDataValid) {
+ if (mDataValid && mCursor != null) {
mCursor.moveToPosition(position);
View v;
if (convertView == null) {
@@ -257,7 +264,8 @@
* @param parent The parent to which the new view is attached to
* @return the newly created view.
*/
- public abstract View newView(Context context, Cursor cursor, ViewGroup parent);
+ public abstract @NonNull View newView(@NonNull Context context, @NonNull Cursor cursor,
+ @Nullable ViewGroup parent);
/**
* Makes a new drop down view to hold the data pointed to by cursor.
@@ -267,7 +275,8 @@
* @param parent The parent to which the new view is attached to
* @return the newly created view.
*/
- public View newDropDownView(Context context, Cursor cursor, ViewGroup parent) {
+ public @NonNull View newDropDownView(@NonNull Context context, @NonNull Cursor cursor,
+ @Nullable ViewGroup parent) {
return newView(context, cursor, parent);
}
@@ -278,7 +287,8 @@
* @param cursor The cursor from which to get the data. The cursor is already
* moved to the correct position.
*/
- public abstract void bindView(View view, Context context, Cursor cursor);
+ public abstract void bindView(@NonNull View view, @NonNull Context context,
+ @NonNull Cursor cursor);
/**
* Change the underlying cursor to a new cursor. If there is an existing cursor it will be
@@ -287,7 +297,7 @@
* @param cursor The new cursor to be used
*/
@Override
- public void changeCursor(Cursor cursor) {
+ public void changeCursor(@Nullable Cursor cursor) {
Cursor old = swapCursor(cursor);
if (old != null) {
old.close();
@@ -304,7 +314,7 @@
* If the given new Cursor is the same instance is the previously set
* Cursor, null is also returned.
*/
- public Cursor swapCursor(Cursor newCursor) {
+ public @Nullable Cursor swapCursor(@Nullable Cursor newCursor) {
if (newCursor == mCursor) {
return null;
}
@@ -340,7 +350,7 @@
* @return a CharSequence representing the value
*/
@Override
- public CharSequence convertToString(Cursor cursor) {
+ public @NonNull CharSequence convertToString(@Nullable Cursor cursor) {
return cursor == null ? "" : cursor.toString();
}
@@ -370,7 +380,7 @@
* @see #setFilterQueryProvider(android.widget.FilterQueryProvider)
*/
@Override
- public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
+ public @Nullable Cursor runQueryOnBackgroundThread(@Nullable CharSequence constraint) {
if (mFilterQueryProvider != null) {
return mFilterQueryProvider.runQuery(constraint);
}
@@ -395,7 +405,7 @@
* @see #setFilterQueryProvider(android.widget.FilterQueryProvider)
* @see #runQueryOnBackgroundThread(CharSequence)
*/
- public FilterQueryProvider getFilterQueryProvider() {
+ public @Nullable FilterQueryProvider getFilterQueryProvider() {
return mFilterQueryProvider;
}
@@ -411,7 +421,7 @@
* @see #getFilterQueryProvider()
* @see #runQueryOnBackgroundThread(CharSequence)
*/
- public void setFilterQueryProvider(FilterQueryProvider filterQueryProvider) {
+ public void setFilterQueryProvider(@Nullable FilterQueryProvider filterQueryProvider) {
mFilterQueryProvider = filterQueryProvider;
}
diff --git a/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/CursorFilter.java b/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/CursorFilter.java
index 5453329..d3a2fc1 100644
--- a/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/CursorFilter.java
+++ b/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/CursorFilter.java
@@ -19,6 +19,9 @@
import android.database.Cursor;
import android.widget.Filter;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
/**
* The CursorFilter delegates most of the work to the
* {@link android.widget.CursorAdapter}. Subclasses should override these
@@ -30,10 +33,10 @@
CursorFilterClient mClient;
interface CursorFilterClient {
- CharSequence convertToString(Cursor cursor);
- Cursor runQueryOnBackgroundThread(CharSequence constraint);
- Cursor getCursor();
- void changeCursor(Cursor cursor);
+ @NonNull CharSequence convertToString(@Nullable Cursor cursor);
+ @Nullable Cursor runQueryOnBackgroundThread(@Nullable CharSequence constraint);
+ @Nullable Cursor getCursor();
+ void changeCursor(@Nullable Cursor cursor);
}
CursorFilter(CursorFilterClient client) {
diff --git a/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/ResourceCursorAdapter.java b/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/ResourceCursorAdapter.java
index 5a45aef..8be23e9 100644
--- a/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/ResourceCursorAdapter.java
+++ b/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/ResourceCursorAdapter.java
@@ -22,6 +22,9 @@
import android.view.View;
import android.view.ViewGroup;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
/**
* Static library support version of the framework's {@link android.widget.ResourceCursorAdapter}.
* Used to write apps that run on platforms prior to Android 3.0. When running
@@ -95,7 +98,8 @@
* @param flags Flags used to determine the behavior of the adapter,
* as per {@link CursorAdapter#CursorAdapter(Context, Cursor, int)}.
*/
- public ResourceCursorAdapter(Context context, int layout, Cursor c, int flags) {
+ public ResourceCursorAdapter(@NonNull Context context, int layout, @Nullable Cursor c,
+ int flags) {
super(context, c, flags);
mLayout = mDropDownLayout = layout;
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -107,13 +111,17 @@
* @see android.widget.CursorAdapter#newView(android.content.Context,
* android.database.Cursor, ViewGroup)
*/
+ @NonNull
@Override
- public View newView(Context context, Cursor cursor, ViewGroup parent) {
+ public View newView(@NonNull Context context, @Nullable Cursor cursor,
+ @Nullable ViewGroup parent) {
return mInflater.inflate(mLayout, parent, false);
}
+ @NonNull
@Override
- public View newDropDownView(Context context, Cursor cursor, ViewGroup parent) {
+ public View newDropDownView(@NonNull Context context, @Nullable Cursor cursor,
+ @Nullable ViewGroup parent) {
return mInflater.inflate(mDropDownLayout, parent, false);
}
diff --git a/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/SimpleCursorAdapter.java b/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/SimpleCursorAdapter.java
index 8c09c6c..6ee6a85 100644
--- a/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/SimpleCursorAdapter.java
+++ b/cursoradapter/cursoradapter/src/main/java/androidx/cursoradapter/widget/SimpleCursorAdapter.java
@@ -25,6 +25,8 @@
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
/**
@@ -41,14 +43,14 @@
* @hide
*/
@RestrictTo(LIBRARY_GROUP_PREFIX)
- protected int[] mFrom;
+ protected @Nullable int[] mFrom;
/**
* A list of View ids representing the views to which the data must be bound.
* This field should be made private, so it is hidden from the SDK.
* @hide
*/
@RestrictTo(LIBRARY_GROUP_PREFIX)
- protected int[] mTo;
+ protected @Nullable int[] mTo;
private int mStringConversionColumn = -1;
private CursorToStringConverter mCursorToStringConverter;
@@ -65,7 +67,8 @@
* use {@link android.app.LoaderManager} with a {@link android.content.CursorLoader}.
*/
@Deprecated
- public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) {
+ public SimpleCursorAdapter(@NonNull Context context, int layout, @Nullable Cursor c,
+ @Nullable String[] from, @Nullable int[] to) {
super(context, layout, c);
mTo = to;
mOriginalFrom = from;
@@ -90,8 +93,8 @@
* @param flags Flags used to determine the behavior of the adapter,
* as per {@link CursorAdapter#CursorAdapter(Context, Cursor, int)}.
*/
- public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from,
- int[] to, int flags) {
+ public SimpleCursorAdapter(@NonNull Context context, int layout, @Nullable Cursor c,
+ @Nullable String[] from, @Nullable int[] to, int flags) {
super(context, layout, c, flags);
mTo = to;
mOriginalFrom = from;
@@ -122,7 +125,12 @@
* @see #setViewText(TextView, String)
*/
@Override
- public void bindView(View view, Context context, Cursor cursor) {
+ public void bindView(@NonNull View view, @NonNull Context context, @NonNull Cursor cursor) {
+ if (mTo == null || mFrom == null || mTo.length != mFrom.length) {
+ throw new IllegalStateException("The `to` and `from` arrays must be non-null and of "
+ + "equal length for binding to occur");
+ }
+
final ViewBinder binder = mViewBinder;
final int count = mTo.length;
final int[] from = mFrom;
@@ -163,7 +171,7 @@
* @see #bindView(android.view.View, android.content.Context, android.database.Cursor)
* @see #setViewBinder(ViewBinder)
*/
- public ViewBinder getViewBinder() {
+ public @Nullable ViewBinder getViewBinder() {
return mViewBinder;
}
@@ -176,7 +184,7 @@
* @see #bindView(android.view.View, android.content.Context, android.database.Cursor)
* @see #getViewBinder()
*/
- public void setViewBinder(ViewBinder viewBinder) {
+ public void setViewBinder(@Nullable ViewBinder viewBinder) {
mViewBinder = viewBinder;
}
@@ -195,7 +203,7 @@
* @param v ImageView to receive an image
* @param value the value retrieved from the cursor
*/
- public void setViewImage(ImageView v, String value) {
+ public void setViewImage(@NonNull ImageView v, @NonNull String value) {
try {
v.setImageResource(Integer.parseInt(value));
} catch (NumberFormatException nfe) {
@@ -214,7 +222,7 @@
* @param v TextView to receive text
* @param text the text to be set for the TextView
*/
- public void setViewText(TextView v, String text) {
+ public void setViewText(@NonNull TextView v, @NonNull String text) {
v.setText(text);
}
@@ -263,7 +271,7 @@
* @see #setStringConversionColumn(int)
* @see android.widget.CursorAdapter#convertToString(android.database.Cursor)
*/
- public CursorToStringConverter getCursorToStringConverter() {
+ public @Nullable CursorToStringConverter getCursorToStringConverter() {
return mCursorToStringConverter;
}
@@ -279,7 +287,8 @@
* @see #setStringConversionColumn(int)
* @see android.widget.CursorAdapter#convertToString(android.database.Cursor)
*/
- public void setCursorToStringConverter(CursorToStringConverter cursorToStringConverter) {
+ public void setCursorToStringConverter(
+ @Nullable CursorToStringConverter cursorToStringConverter) {
mCursorToStringConverter = cursorToStringConverter;
}
@@ -295,10 +304,10 @@
* @return a non-null CharSequence representing the cursor
*/
@Override
- public CharSequence convertToString(Cursor cursor) {
+ public @NonNull CharSequence convertToString(@Nullable Cursor cursor) {
if (mCursorToStringConverter != null) {
return mCursorToStringConverter.convertToString(cursor);
- } else if (mStringConversionColumn > -1) {
+ } else if (mStringConversionColumn > -1 && cursor != null) {
return cursor.getString(mStringConversionColumn);
}
@@ -312,8 +321,8 @@
* @param c the cursor to find the columns from
* @param from the Strings naming the columns of interest
*/
- private void findColumns(Cursor c, String[] from) {
- if (c != null) {
+ private void findColumns(@Nullable Cursor c, @Nullable String[] from) {
+ if (c != null && from != null) {
int i;
int count = from.length;
if (mFrom == null || mFrom.length != count) {
@@ -328,7 +337,7 @@
}
@Override
- public Cursor swapCursor(Cursor newCursor) {
+ public @Nullable Cursor swapCursor(@Nullable Cursor newCursor) {
// super.swapCursor() will notify observers before we have
// a valid mapping, make sure we have a mapping before this
// happens
@@ -347,7 +356,8 @@
* are given the values of the first N columns in the from
* parameter. Can be null if the cursor is not available yet.
*/
- public void changeCursorAndColumns(Cursor c, String[] from, int[] to) {
+ public void changeCursorAndColumns(@Nullable Cursor c, @Nullable String[] from,
+ @Nullable int[] to) {
mOriginalFrom = from;
mTo = to;
// super.changeCursor() will notify observers before we have
@@ -384,7 +394,7 @@
*
* @return true if the data was bound to the view, false otherwise
*/
- boolean setViewValue(View view, Cursor cursor, int columnIndex);
+ boolean setViewValue(@NonNull View view, @NonNull Cursor cursor, int columnIndex);
}
/**
@@ -402,7 +412,7 @@
*
* @return a non-null CharSequence representing the cursor
*/
- CharSequence convertToString(Cursor cursor);
+ @NonNull CharSequence convertToString(@Nullable Cursor cursor);
}
}
diff --git a/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/KotlinSerializationActivity.kt b/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/KotlinSerializationActivity.kt
index 368ca4f..1d78255 100644
--- a/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/KotlinSerializationActivity.kt
+++ b/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/KotlinSerializationActivity.kt
@@ -45,7 +45,7 @@
@OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class)
class KotlinSerializationActivity : AppCompatActivity() {
- private val TAG = "KotlinSerializationActivity"
+ private val TAG = "SerializationActivity"
private val PROTO_STORE_FILE_NAME = "kotlin_serialization_test_file.json"
diff --git a/development/build_log_simplifier/messages.ignore b/development/build_log_simplifier/messages.ignore
index 891da00..376a686 100644
--- a/development/build_log_simplifier/messages.ignore
+++ b/development/build_log_simplifier/messages.ignore
@@ -169,7 +169,7 @@
Please consult deprecation warnings for more details\.
BUILD SUCCESSFUL in .*
Publishing build scan\.\.\.
-https://ge\.androidx\.dev/s/n[0-9]+wdd[0-9]+vkeetqk
+https://ge\.androidx\.dev/s/.*
Configuration cache entry reused with [0-9]+ problem\.
# > Task :doclava:compileJava
Note\: Some input files use or override a deprecated API\.
diff --git a/emoji2/emoji2/src/androidTest/java/androidx/emoji2/text/NoFontTestEmojiConfig.java b/emoji2/emoji2/src/androidTest/java/androidx/emoji2/text/NoFontTestEmojiConfig.java
index 812a223..648f1bd 100644
--- a/emoji2/emoji2/src/androidTest/java/androidx/emoji2/text/NoFontTestEmojiConfig.java
+++ b/emoji2/emoji2/src/androidTest/java/androidx/emoji2/text/NoFontTestEmojiConfig.java
@@ -19,9 +19,12 @@
import static org.mockito.Mockito.mock;
import android.graphics.Typeface;
+import android.os.Build;
import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
+@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public class NoFontTestEmojiConfig extends EmojiCompat.Config {
static EmojiCompat.Config emptyConfig() {
diff --git a/exifinterface/exifinterface/api/current.txt b/exifinterface/exifinterface/api/current.txt
index 9b55e85..a1554c4 100644
--- a/exifinterface/exifinterface/api/current.txt
+++ b/exifinterface/exifinterface/api/current.txt
@@ -33,7 +33,7 @@
method public void saveAttributes() throws java.io.IOException;
method public void setAltitude(double);
method public void setAttribute(String, String?);
- method public void setGpsInfo(android.location.Location!);
+ method public void setGpsInfo(android.location.Location?);
method public void setLatLong(double, double);
field public static final short ALTITUDE_ABOVE_SEA_LEVEL = 0; // 0x0
field public static final short ALTITUDE_BELOW_SEA_LEVEL = 1; // 0x1
diff --git a/exifinterface/exifinterface/api/public_plus_experimental_current.txt b/exifinterface/exifinterface/api/public_plus_experimental_current.txt
index 9b55e85..a1554c4 100644
--- a/exifinterface/exifinterface/api/public_plus_experimental_current.txt
+++ b/exifinterface/exifinterface/api/public_plus_experimental_current.txt
@@ -33,7 +33,7 @@
method public void saveAttributes() throws java.io.IOException;
method public void setAltitude(double);
method public void setAttribute(String, String?);
- method public void setGpsInfo(android.location.Location!);
+ method public void setGpsInfo(android.location.Location?);
method public void setLatLong(double, double);
field public static final short ALTITUDE_ABOVE_SEA_LEVEL = 0; // 0x0
field public static final short ALTITUDE_BELOW_SEA_LEVEL = 1; // 0x1
diff --git a/exifinterface/exifinterface/api/restricted_current.txt b/exifinterface/exifinterface/api/restricted_current.txt
index 9b55e85..a1554c4 100644
--- a/exifinterface/exifinterface/api/restricted_current.txt
+++ b/exifinterface/exifinterface/api/restricted_current.txt
@@ -33,7 +33,7 @@
method public void saveAttributes() throws java.io.IOException;
method public void setAltitude(double);
method public void setAttribute(String, String?);
- method public void setGpsInfo(android.location.Location!);
+ method public void setGpsInfo(android.location.Location?);
method public void setLatLong(double, double);
field public static final short ALTITUDE_ABOVE_SEA_LEVEL = 0; // 0x0
field public static final short ALTITUDE_BELOW_SEA_LEVEL = 1; // 0x1
diff --git a/exifinterface/exifinterface/lint-baseline.xml b/exifinterface/exifinterface/lint-baseline.xml
deleted file mode 100644
index 430092c..0000000
--- a/exifinterface/exifinterface/lint-baseline.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.3.0-alpha07" type="baseline" client="gradle" dependencies="false" name="AGP (7.3.0-alpha07)" variant="all" version="7.3.0-alpha07">
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public void setGpsInfo(Location location) {"
- errorLine2=" ~~~~~~~~">
- <location
- file="src/main/java/androidx/exifinterface/media/ExifInterface.java"/>
- </issue>
-
-</issues>
diff --git a/exifinterface/exifinterface/src/main/java/androidx/exifinterface/media/ExifInterface.java b/exifinterface/exifinterface/src/main/java/androidx/exifinterface/media/ExifInterface.java
index e5d2274..84de192 100644
--- a/exifinterface/exifinterface/src/main/java/androidx/exifinterface/media/ExifInterface.java
+++ b/exifinterface/exifinterface/src/main/java/androidx/exifinterface/media/ExifInterface.java
@@ -5057,9 +5057,11 @@
* Sets the GPS-related information. It will set GPS processing method, latitude and longitude
* values, GPS timestamp, and speed information at the same time.
*
+ * This method is a No-Op if the location parameter is null.
+ *
* @param location the {@link Location} object returned by GPS service.
*/
- public void setGpsInfo(Location location) {
+ public void setGpsInfo(@Nullable Location location) {
if (location == null) {
return;
}
diff --git a/fragment/fragment/api/restricted_current.txt b/fragment/fragment/api/restricted_current.txt
index 7f0aa7c..3c1054e 100644
--- a/fragment/fragment/api/restricted_current.txt
+++ b/fragment/fragment/api/restricted_current.txt
@@ -445,26 +445,26 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public abstract class FragmentTransitionImpl {
ctor public FragmentTransitionImpl();
- method public abstract void addTarget(Object!, android.view.View!);
- method public abstract void addTargets(Object!, java.util.ArrayList<android.view.View!>!);
- method public abstract void beginDelayedTransition(android.view.ViewGroup!, Object!);
+ method public abstract void addTarget(Object, android.view.View);
+ method public abstract void addTargets(Object, java.util.ArrayList<android.view.View!>);
+ method public abstract void beginDelayedTransition(android.view.ViewGroup, Object?);
method protected static void bfsAddViewChildren(java.util.List<android.view.View!>!, android.view.View!);
- method public abstract boolean canHandle(Object!);
- method public abstract Object! cloneTransition(Object!);
+ method public abstract boolean canHandle(Object);
+ method public abstract Object! cloneTransition(Object?);
method protected void getBoundsOnScreen(android.view.View!, android.graphics.Rect!);
method protected static boolean isNullOrEmpty(java.util.List!);
- method public abstract Object! mergeTransitionsInSequence(Object!, Object!, Object!);
- method public abstract Object! mergeTransitionsTogether(Object!, Object!, Object!);
- method public abstract void removeTarget(Object!, android.view.View!);
- method public abstract void replaceTargets(Object!, java.util.ArrayList<android.view.View!>!, java.util.ArrayList<android.view.View!>!);
- method public abstract void scheduleHideFragmentView(Object!, android.view.View!, java.util.ArrayList<android.view.View!>!);
- method public abstract void scheduleRemoveTargets(Object!, Object!, java.util.ArrayList<android.view.View!>!, Object!, java.util.ArrayList<android.view.View!>!, Object!, java.util.ArrayList<android.view.View!>!);
- method public abstract void setEpicenter(Object!, android.view.View!);
- method public abstract void setEpicenter(Object!, android.graphics.Rect!);
+ method public abstract Object! mergeTransitionsInSequence(Object?, Object?, Object?);
+ method public abstract Object! mergeTransitionsTogether(Object, Object, Object?);
+ method public abstract void removeTarget(Object, android.view.View);
+ method public abstract void replaceTargets(Object, java.util.ArrayList<android.view.View!>!, java.util.ArrayList<android.view.View!>!);
+ method public abstract void scheduleHideFragmentView(Object, android.view.View, java.util.ArrayList<android.view.View!>);
+ method public abstract void scheduleRemoveTargets(Object, Object?, java.util.ArrayList<android.view.View!>?, Object?, java.util.ArrayList<android.view.View!>?, Object?, java.util.ArrayList<android.view.View!>?);
+ method public abstract void setEpicenter(Object, android.view.View);
+ method public abstract void setEpicenter(Object, android.graphics.Rect);
method public void setListenerForTransitionEnd(androidx.fragment.app.Fragment, Object, androidx.core.os.CancellationSignal, Runnable);
- method public abstract void setSharedElementTargets(Object!, android.view.View!, java.util.ArrayList<android.view.View!>!);
- method public abstract void swapSharedElementTargets(Object!, java.util.ArrayList<android.view.View!>!, java.util.ArrayList<android.view.View!>!);
- method public abstract Object! wrapTransitionInSet(Object!);
+ method public abstract void setSharedElementTargets(Object, android.view.View, java.util.ArrayList<android.view.View!>);
+ method public abstract void swapSharedElementTargets(Object?, java.util.ArrayList<android.view.View!>?, java.util.ArrayList<android.view.View!>?);
+ method public abstract Object! wrapTransitionInSet(Object?);
}
public class ListFragment extends androidx.fragment.app.Fragment {
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentTestUtil.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentTestUtil.kt
index 800e19e..ffbc8a1 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentTestUtil.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentTestUtil.kt
@@ -20,6 +20,7 @@
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
+import androidx.annotation.RequiresApi
import androidx.fragment.test.R
import androidx.test.core.app.ActivityScenario
import androidx.test.platform.app.InstrumentationRegistry
@@ -28,7 +29,6 @@
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertWithMessage
import java.lang.ref.WeakReference
-import java.util.ArrayList
fun FragmentTransaction.setReorderingAllowed(
reorderingAllowed: ReorderingAllowed
@@ -153,6 +153,7 @@
clearTargets()
}
+@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
fun verifyNoOtherTransitions(fragment: TransitionFragment) {
assertThat(fragment.enterTransition.enteringTargets).isEmpty()
assertThat(fragment.enterTransition.exitingTargets).isEmpty()
diff --git a/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransitionCompat21.java b/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransitionCompat21.java
index 06ff3dc..9abe01b 100644
--- a/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransitionCompat21.java
+++ b/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransitionCompat21.java
@@ -16,6 +16,7 @@
package androidx.fragment.app;
+import android.annotation.SuppressLint;
import android.graphics.Rect;
import android.transition.Transition;
import android.transition.TransitionManager;
@@ -24,6 +25,7 @@
import android.view.ViewGroup;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.os.CancellationSignal;
@@ -34,12 +36,12 @@
class FragmentTransitionCompat21 extends FragmentTransitionImpl {
@Override
- public boolean canHandle(Object transition) {
+ public boolean canHandle(@NonNull Object transition) {
return transition instanceof Transition;
}
@Override
- public Object cloneTransition(Object transition) {
+ public Object cloneTransition(@Nullable Object transition) {
Transition copy = null;
if (transition != null) {
copy = ((Transition) transition).clone();
@@ -48,7 +50,7 @@
}
@Override
- public Object wrapTransitionInSet(Object transition) {
+ public Object wrapTransitionInSet(@Nullable Object transition) {
if (transition == null) {
return null;
}
@@ -58,8 +60,8 @@
}
@Override
- public void setSharedElementTargets(Object transitionObj,
- View nonExistentView, ArrayList<View> sharedViews) {
+ public void setSharedElementTargets(@NonNull Object transitionObj,
+ @NonNull View nonExistentView, @NonNull ArrayList<View> sharedViews) {
TransitionSet transition = (TransitionSet) transitionObj;
final List<View> views = transition.getTargets();
views.clear();
@@ -74,7 +76,7 @@
}
@Override
- public void setEpicenter(Object transitionObj, View view) {
+ public void setEpicenter(@NonNull Object transitionObj, @NonNull View view) {
if (view != null) {
Transition transition = (Transition) transitionObj;
final Rect epicenter = new Rect();
@@ -90,7 +92,7 @@
}
@Override
- public void addTargets(Object transitionObj, ArrayList<View> views) {
+ public void addTargets(@NonNull Object transitionObj, @NonNull ArrayList<View> views) {
Transition transition = (Transition) transitionObj;
if (transition == null) {
return;
@@ -124,8 +126,8 @@
}
@Override
- public Object mergeTransitionsTogether(Object transition1, Object transition2,
- Object transition3) {
+ public Object mergeTransitionsTogether(@NonNull Object transition1, @NonNull Object transition2,
+ @Nullable Object transition3) {
TransitionSet transitionSet = new TransitionSet();
if (transition1 != null) {
transitionSet.addTransition((Transition) transition1);
@@ -140,8 +142,9 @@
}
@Override
- public void scheduleHideFragmentView(Object exitTransitionObj, final View fragmentView,
- final ArrayList<View> exitingViews) {
+ public void scheduleHideFragmentView(@NonNull Object exitTransitionObj,
+ @NonNull final View fragmentView,
+ @NonNull final ArrayList<View> exitingViews) {
Transition exitTransition = (Transition) exitTransitionObj;
exitTransition.addListener(new Transition.TransitionListener() {
@Override
@@ -152,13 +155,13 @@
// views after our onTransitionEnd callback.
// We need to make sure this listener gets the onTransitionEnd callback last to
// ensure that exiting views are made visible once the Transition is complete.
- Api19Impl.removeListener(transition, this);
- Api19Impl.addListener(transition, this);
+ transition.removeListener(this);
+ transition.addListener(this);
}
@Override
public void onTransitionEnd(Transition transition) {
- Api19Impl.removeListener(transition, this);
+ transition.removeListener(this);
fragmentView.setVisibility(View.GONE);
final int numViews = exitingViews.size();
for (int i = 0; i < numViews; i++) {
@@ -181,8 +184,8 @@
}
@Override
- public Object mergeTransitionsInSequence(Object exitTransitionObj,
- Object enterTransitionObj, Object sharedElementTransitionObj) {
+ public Object mergeTransitionsInSequence(@Nullable Object exitTransitionObj,
+ @Nullable Object enterTransitionObj, @Nullable Object sharedElementTransitionObj) {
// First do exit, then enter, but allow shared element transition to happen
// during both.
Transition staggered = null;
@@ -212,15 +215,16 @@
}
@Override
- public void beginDelayedTransition(ViewGroup sceneRoot, Object transition) {
+ public void beginDelayedTransition(@NonNull ViewGroup sceneRoot, @Nullable Object transition) {
TransitionManager.beginDelayedTransition(sceneRoot, (Transition) transition);
}
@Override
- public void scheduleRemoveTargets(final Object overallTransitionObj,
- final Object enterTransition, final ArrayList<View> enteringViews,
- final Object exitTransition, final ArrayList<View> exitingViews,
- final Object sharedElementTransition, final ArrayList<View> sharedElementsIn) {
+ public void scheduleRemoveTargets(@NonNull final Object overallTransitionObj,
+ @Nullable final Object enterTransition, @Nullable final ArrayList<View> enteringViews,
+ @Nullable final Object exitTransition, @Nullable final ArrayList<View> exitingViews,
+ @Nullable final Object sharedElementTransition,
+ @Nullable final ArrayList<View> sharedElementsIn) {
final Transition overallTransition = (Transition) overallTransitionObj;
overallTransition.addListener(new Transition.TransitionListener() {
@Override
@@ -238,7 +242,7 @@
@Override
public void onTransitionEnd(Transition transition) {
- Api19Impl.removeListener(transition, this);
+ transition.removeListener(this);
}
@Override
@@ -289,8 +293,9 @@
}
@Override
- public void swapSharedElementTargets(Object sharedElementTransitionObj,
- ArrayList<View> sharedElementsOut, ArrayList<View> sharedElementsIn) {
+ public void swapSharedElementTargets(@Nullable Object sharedElementTransitionObj,
+ @Nullable ArrayList<View> sharedElementsOut,
+ @Nullable ArrayList<View> sharedElementsIn) {
TransitionSet sharedElementTransition = (TransitionSet) sharedElementTransitionObj;
if (sharedElementTransition != null) {
sharedElementTransition.getTargets().clear();
@@ -300,8 +305,9 @@
}
@Override
- public void replaceTargets(Object transitionObj, ArrayList<View> oldTargets,
- ArrayList<View> newTargets) {
+ public void replaceTargets(@NonNull Object transitionObj,
+ @SuppressLint("UnknownNullness") ArrayList<View> oldTargets,
+ @SuppressLint("UnknownNullness") ArrayList<View> newTargets) {
Transition transition = (Transition) transitionObj;
if (transition instanceof TransitionSet) {
TransitionSet set = (TransitionSet) transition;
@@ -327,7 +333,7 @@
}
@Override
- public void addTarget(Object transitionObj, View view) {
+ public void addTarget(@NonNull Object transitionObj, @NonNull View view) {
if (transitionObj != null) {
Transition transition = (Transition) transitionObj;
transition.addTarget(view);
@@ -335,7 +341,7 @@
}
@Override
- public void removeTarget(Object transitionObj, View view) {
+ public void removeTarget(@NonNull Object transitionObj, @NonNull View view) {
if (transitionObj != null) {
Transition transition = (Transition) transitionObj;
transition.removeTarget(view);
@@ -343,7 +349,7 @@
}
@Override
- public void setEpicenter(Object transitionObj, final Rect epicenter) {
+ public void setEpicenter(@NonNull Object transitionObj, @NonNull final Rect epicenter) {
if (transitionObj != null) {
Transition transition = (Transition) transitionObj;
transition.setEpicenterCallback(new Transition.EpicenterCallback() {
@@ -357,19 +363,4 @@
});
}
}
-
- @RequiresApi(19)
- static class Api19Impl {
- private Api19Impl() { }
-
- static void addListener(@NonNull Transition transition,
- @NonNull Transition.TransitionListener listener) {
- transition.addListener(listener);
- }
-
- static void removeListener(@NonNull Transition transition,
- @NonNull Transition.TransitionListener listener) {
- transition.removeListener(listener);
- }
- }
}
diff --git a/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransitionImpl.java b/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransitionImpl.java
index 9e3846a..e82df80 100644
--- a/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransitionImpl.java
+++ b/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransitionImpl.java
@@ -26,6 +26,7 @@
import android.view.ViewParent;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.core.os.CancellationSignal;
import androidx.core.view.OneShotPreDrawListener;
@@ -46,18 +47,18 @@
/**
* Returns {@code true} if this implementation can handle the specified {@link transition}.
*/
- public abstract boolean canHandle(Object transition);
+ public abstract boolean canHandle(@NonNull Object transition);
/**
* Returns a clone of a transition or null if it is null
*/
- public abstract Object cloneTransition(Object transition);
+ public abstract Object cloneTransition(@Nullable Object transition);
/**
* Wraps a transition in a TransitionSet and returns the set. If transition is null, null is
* returned.
*/
- public abstract Object wrapTransitionInSet(Object transition);
+ public abstract Object wrapTransitionInSet(@Nullable Object transition);
/**
* Finds all children of the shared elements and sets the wrapping TransitionSet
@@ -65,13 +66,13 @@
* specific shared elements. This allows developers to target child views of the
* shared elements specifically, but this doesn't happen by default.
*/
- public abstract void setSharedElementTargets(Object transitionObj,
- View nonExistentView, ArrayList<View> sharedViews);
+ public abstract void setSharedElementTargets(@NonNull Object transitionObj,
+ @NonNull View nonExistentView, @NonNull ArrayList<View> sharedViews);
/**
* Sets a transition epicenter to the rectangle of a given View.
*/
- public abstract void setEpicenter(Object transitionObj, View view);
+ public abstract void setEpicenter(@NonNull Object transitionObj, @NonNull View view);
/**
* Replacement for view.getBoundsOnScreen because that is not public. This returns a rect
@@ -114,22 +115,22 @@
* Otherwise, if you happened to have targeted the exact views for the transition,
* the replaceTargets call will remove them unexpectedly.
*/
- public abstract void addTargets(Object transitionObj, ArrayList<View> views);
+ public abstract void addTargets(@NonNull Object transitionObj, @NonNull ArrayList<View> views);
/**
* Creates a TransitionSet that plays all passed transitions together. Any null
* transitions passed will not be added to the set. If all are null, then an empty
* TransitionSet will be returned.
*/
- public abstract Object mergeTransitionsTogether(Object transition1, Object transition2,
- Object transition3);
+ public abstract Object mergeTransitionsTogether(@NonNull Object transition1,
+ @NonNull Object transition2, @Nullable Object transition3);
/**
* After the transition completes, the fragment's view is set to GONE and the exiting
* views are set to VISIBLE.
*/
- public abstract void scheduleHideFragmentView(Object exitTransitionObj, View fragmentView,
- ArrayList<View> exitingViews);
+ public abstract void scheduleHideFragmentView(@NonNull Object exitTransitionObj,
+ @NonNull View fragmentView, @NonNull ArrayList<View> exitingViews);
/**
* Combines enter, exit, and shared element transition so that they play in the proper
@@ -140,13 +141,14 @@
* @return A TransitionSet with all of enter, exit, and shared element transitions in
* it (modulo null values), ordered such that they play in the proper sequence.
*/
- public abstract Object mergeTransitionsInSequence(Object exitTransitionObj,
- Object enterTransitionObj, Object sharedElementTransitionObj);
+ public abstract Object mergeTransitionsInSequence(@Nullable Object exitTransitionObj,
+ @Nullable Object enterTransitionObj, @Nullable Object sharedElementTransitionObj);
/**
* Calls {@code TransitionManager#beginDelayedTransition(ViewGroup, Transition)}.
*/
- public abstract void beginDelayedTransition(ViewGroup sceneRoot, Object transition);
+ public abstract void beginDelayedTransition(@NonNull ViewGroup sceneRoot,
+ @Nullable Object transition);
/**
* Prepares for setting the shared element names by gathering the names of the incoming
@@ -210,10 +212,10 @@
* After the transition has started, remove all targets that we added to the transitions
* so that the transitions are left in a clean state.
*/
- public abstract void scheduleRemoveTargets(Object overallTransitionObj,
- Object enterTransition, ArrayList<View> enteringViews,
- Object exitTransition, ArrayList<View> exitingViews,
- Object sharedElementTransition, ArrayList<View> sharedElementsIn);
+ public abstract void scheduleRemoveTargets(@NonNull Object overallTransitionObj,
+ @Nullable Object enterTransition, @Nullable ArrayList<View> enteringViews,
+ @Nullable Object exitTransition, @Nullable ArrayList<View> exitingViews,
+ @Nullable Object sharedElementTransition, @Nullable ArrayList<View> sharedElementsIn);
/**
@@ -236,8 +238,9 @@
* Swap the targets for the shared element transition from those Views in sharedElementsOut
* to those in sharedElementsIn
*/
- public abstract void swapSharedElementTargets(Object sharedElementTransitionObj,
- ArrayList<View> sharedElementsOut, ArrayList<View> sharedElementsIn);
+ public abstract void swapSharedElementTargets(@Nullable Object sharedElementTransitionObj,
+ @Nullable ArrayList<View> sharedElementsOut,
+ @Nullable ArrayList<View> sharedElementsIn);
/**
* This method removes the views from transitions that target ONLY those views and
@@ -245,24 +248,25 @@
* The views list should match those added in addTargets and should contain
* one view that is not in the view hierarchy (state.nonExistentView).
*/
- public abstract void replaceTargets(Object transitionObj, ArrayList<View> oldTargets,
- ArrayList<View> newTargets);
+ public abstract void replaceTargets(@NonNull Object transitionObj,
+ @SuppressLint("UnknownNullness") ArrayList<View> oldTargets,
+ @SuppressLint("UnknownNullness") ArrayList<View> newTargets);
/**
* Adds a View target to a transition. If transitionObj is null, nothing is done.
*/
- public abstract void addTarget(Object transitionObj, View view);
+ public abstract void addTarget(@NonNull Object transitionObj, @NonNull View view);
/**
* Remove a View target to a transition. If transitionObj is null, nothing is done.
*/
- public abstract void removeTarget(Object transitionObj, View view);
+ public abstract void removeTarget(@NonNull Object transitionObj, @NonNull View view);
/**
* Sets the epicenter of a transition to a rect object. The object can be modified until
* the transition runs.
*/
- public abstract void setEpicenter(Object transitionObj, Rect epicenter);
+ public abstract void setEpicenter(@NonNull Object transitionObj, @NonNull Rect epicenter);
/**
* Uses a breadth-first scheme to add startView and all of its children to views.
diff --git a/glance/glance-appwidget/api/current.txt b/glance/glance-appwidget/api/current.txt
index 94406e76..ffc91fb 100644
--- a/glance/glance-appwidget/api/current.txt
+++ b/glance/glance-appwidget/api/current.txt
@@ -300,7 +300,7 @@
property public androidx.glance.state.GlanceStateDefinition<?>? stateDefinition;
}
- public final class ListTemplateLayoutsKt {
+ @androidx.glance.GlanceComposable public final class ListTemplateLayoutsKt {
method @androidx.compose.runtime.Composable public static void ListTemplate(androidx.glance.template.ListTemplateData data);
}
diff --git a/glance/glance-appwidget/api/public_plus_experimental_current.txt b/glance/glance-appwidget/api/public_plus_experimental_current.txt
index 43243dd..0d3fa5f 100644
--- a/glance/glance-appwidget/api/public_plus_experimental_current.txt
+++ b/glance/glance-appwidget/api/public_plus_experimental_current.txt
@@ -314,7 +314,7 @@
property public androidx.glance.state.GlanceStateDefinition<?>? stateDefinition;
}
- public final class ListTemplateLayoutsKt {
+ @androidx.glance.GlanceComposable public final class ListTemplateLayoutsKt {
method @androidx.compose.runtime.Composable public static void ListTemplate(androidx.glance.template.ListTemplateData data);
}
diff --git a/glance/glance-appwidget/api/restricted_current.txt b/glance/glance-appwidget/api/restricted_current.txt
index 94406e76..ffc91fb 100644
--- a/glance/glance-appwidget/api/restricted_current.txt
+++ b/glance/glance-appwidget/api/restricted_current.txt
@@ -300,7 +300,7 @@
property public androidx.glance.state.GlanceStateDefinition<?>? stateDefinition;
}
- public final class ListTemplateLayoutsKt {
+ @androidx.glance.GlanceComposable public final class ListTemplateLayoutsKt {
method @androidx.compose.runtime.Composable public static void ListTemplate(androidx.glance.template.ListTemplateData data);
}
diff --git a/glance/glance-appwidget/integration-tests/template-demos/src/main/AndroidManifest.xml b/glance/glance-appwidget/integration-tests/template-demos/src/main/AndroidManifest.xml
index 70ec996..a94dd60 100644
--- a/glance/glance-appwidget/integration-tests/template-demos/src/main/AndroidManifest.xml
+++ b/glance/glance-appwidget/integration-tests/template-demos/src/main/AndroidManifest.xml
@@ -50,10 +50,52 @@
</receiver>
<receiver
- android:name="androidx.glance.appwidget.template.demos.ListDemoWidgetReceiver"
+ android:name="androidx.glance.appwidget.template.demos.FullActionListReceiver"
android:enabled="@bool/glance_appwidget_available"
android:exported="false"
- android:label="@string/list_template_widget_name">
+ android:label="@string/list_style_with_header_action">
+ <intent-filter>
+ <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+ <action android:name="android.intent.action.LOCALE_CHANGED" />
+ </intent-filter>
+ <meta-data
+ android:name="android.appwidget.provider"
+ android:resource="@xml/default_app_widget_info" />
+ </receiver>
+
+ <receiver
+ android:name="androidx.glance.appwidget.template.demos.FullHeaderListReceiver"
+ android:enabled="@bool/glance_appwidget_available"
+ android:exported="false"
+ android:label="@string/list_style_with_header">
+ <intent-filter>
+ <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+ <action android:name="android.intent.action.LOCALE_CHANGED" />
+ </intent-filter>
+ <meta-data
+ android:name="android.appwidget.provider"
+ android:resource="@xml/default_app_widget_info" />
+ </receiver>
+
+ <receiver
+ android:name="androidx.glance.appwidget.template.demos.NoHeaderListReceiver"
+ android:enabled="@bool/glance_appwidget_available"
+ android:exported="false"
+ android:label="@string/list_style_no_header">
+ <intent-filter>
+ <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+ <action android:name="android.intent.action.LOCALE_CHANGED" />
+ </intent-filter>
+ <meta-data
+ android:name="android.appwidget.provider"
+ android:resource="@xml/default_app_widget_info" />
+ </receiver>
+
+ <receiver
+ android:name="androidx.glance.appwidget.template.demos.BriefListReceiver"
+ android:enabled="@bool/glance_appwidget_available"
+ android:exported="false"
+ android:label="@string/list_style_brief">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.intent.action.LOCALE_CHANGED" />
diff --git a/glance/glance-appwidget/integration-tests/template-demos/src/main/java/androidx/glance/appwidget/template/demos/ListDemoWidget.kt b/glance/glance-appwidget/integration-tests/template-demos/src/main/java/androidx/glance/appwidget/template/demos/ListDemoWidget.kt
index 88649a0..d55bac6 100644
--- a/glance/glance-appwidget/integration-tests/template-demos/src/main/java/androidx/glance/appwidget/template/demos/ListDemoWidget.kt
+++ b/glance/glance-appwidget/integration-tests/template-demos/src/main/java/androidx/glance/appwidget/template/demos/ListDemoWidget.kt
@@ -14,96 +14,195 @@
* limitations under the License.
*/
+@file:GlanceComposable
+
package androidx.glance.appwidget.template.demos
import android.content.Context
import androidx.compose.runtime.Composable
+import androidx.compose.ui.graphics.Color
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.intPreferencesKey
+import androidx.glance.GlanceComposable
import androidx.glance.GlanceId
import androidx.glance.ImageProvider
+import androidx.glance.action.Action
import androidx.glance.action.ActionParameters
import androidx.glance.action.actionParametersOf
import androidx.glance.appwidget.GlanceAppWidget
import androidx.glance.appwidget.GlanceAppWidgetReceiver
-import androidx.glance.appwidget.SizeMode
import androidx.glance.appwidget.action.ActionCallback
import androidx.glance.appwidget.action.actionRunCallback
import androidx.glance.appwidget.state.updateAppWidgetState
import androidx.glance.appwidget.template.GlanceTemplateAppWidget
import androidx.glance.appwidget.template.ListTemplate
import androidx.glance.currentState
+import androidx.glance.template.ListStyle
import androidx.glance.template.ListTemplateData
import androidx.glance.template.ListTemplateItem
import androidx.glance.template.TemplateImageButton
import androidx.glance.template.TemplateImageWithDescription
import androidx.glance.template.TemplateText
-import androidx.glance.template.TemplateTextButton
import androidx.glance.unit.ColorProvider
-class ListDemoWidget : GlanceTemplateAppWidget() {
- override val sizeMode = SizeMode.Exact
-
+/**
+ * List demo with list items in full details and list header with action button using data and list
+ * template from [BaseListDemoWidget].
+ */
+class FullHeaderActionListDemoWidget : BaseListDemoWidget() {
@Composable
- override fun TemplateContent() {
+ override fun TemplateContent() = ListTemplateContent(ListStyle.Full, true, true, 1)
+
+ override fun headerButtonAction(): Action = actionRunCallback<ListAddButtonAction>()
+
+ override fun itemSelectAction(params: ActionParameters): Action =
+ actionRunCallback<ListTemplateItemAction>(params)
+}
+
+/**
+ * List demo with list items in full details and list header without action button using data and
+ * list template from [BaseListDemoWidget].
+ */
+class FullHeaderListDemoWidget : BaseListDemoWidget() {
+ @Composable
+ override fun TemplateContent() = ListTemplateContent(ListStyle.Full, true)
+}
+
+/**
+ * List demo with list items in some details without list header and action button using data and
+ * list template from [BaseListDemoWidget].
+ */
+class NoHeaderListDemoWidget : BaseListDemoWidget() {
+ @Composable
+ override fun TemplateContent() = ListTemplateContent(ListStyle.Full)
+}
+
+/**
+ * Brief list demo with list items in minimum details and compact form without list header and
+ * action button using data and list template from [BaseListDemoWidget].
+ */
+class BriefListDemoWidget : BaseListDemoWidget() {
+ @Composable
+ override fun TemplateContent() = ListTemplateContent(ListStyle.Brief)
+}
+
+class FullActionListReceiver : GlanceAppWidgetReceiver() {
+ override val glanceAppWidget: GlanceAppWidget = FullHeaderActionListDemoWidget()
+}
+
+class FullHeaderListReceiver : GlanceAppWidgetReceiver() {
+ override val glanceAppWidget: GlanceAppWidget = FullHeaderListDemoWidget()
+}
+
+class NoHeaderListReceiver : GlanceAppWidgetReceiver() {
+ override val glanceAppWidget: GlanceAppWidget = NoHeaderListDemoWidget()
+}
+
+class BriefListReceiver : GlanceAppWidgetReceiver() {
+ override val glanceAppWidget: GlanceAppWidget = BriefListDemoWidget()
+}
+
+/**
+ * Base List Demo app widget creating demo data by [ListTemplateData] to layout by [ListTemplate].
+ * It is overridable by list style, header action, and item selection action.
+ */
+abstract class BaseListDemoWidget : GlanceTemplateAppWidget() {
+ /**
+ * Defines the handling of header button action.
+ */
+ open fun headerButtonAction(): Action = actionRunCallback<DefaultNoopAction>()
+
+ /**
+ * Defines the handling of item select action.
+ *
+ * @param params action parameters for selection index
+ */
+ open fun itemSelectAction(params: ActionParameters): Action =
+ actionRunCallback<DefaultNoopAction>()
+
+ /**
+ * Create list data and render list template by list style.
+ *
+ * @param listStyle styling the list by [ListStyle] based data details
+ * @param initialNumItems initial number of list items to generate in the demo
+ * @param showHeaderAction whether to show list header action button
+ * @param showHeader whether to show list header as a whole
+ */
+ @Composable
+ internal fun ListTemplateContent(
+ listStyle: ListStyle,
+ showHeader: Boolean = false,
+ showHeaderAction: Boolean = false,
+ initialNumItems: Int = 3,
+ ) {
val state = currentState<Preferences>()
val content = mutableListOf<ListTemplateItem>()
- for (i in 1..(state[CountKey] ?: 1)) {
+ for (i in 1..(state[CountKey] ?: initialNumItems)) {
var label = "Item $i"
if (state[ItemClickedKey] == i) {
- label = "$label (clicked)"
+ label = "$label (selected)"
}
content.add(
ListTemplateItem(
- title = TemplateText(
+ title = TemplateText("Title Medium", TemplateText.Type.Title),
+ body = TemplateText(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit",
- TemplateText.Type.Title
+ TemplateText.Type.Body
),
- body = TemplateText(label, TemplateText.Type.Label),
- image = TemplateImageWithDescription(
- ImageProvider(R.drawable.ic_favorite), "List item $i image"
- ),
+ label = TemplateText(label, TemplateText.Type.Label),
+ image = TemplateImageWithDescription(ImageProvider(R.drawable.compose), "$i"),
button = TemplateImageButton(
- actionRunCallback<ListTemplateItemAction>(
+ itemSelectAction(
actionParametersOf(ClickedKey to i)
),
- TemplateImageWithDescription(ImageProvider(R.drawable.compose), "button")
+ TemplateImageWithDescription(
+ ImageProvider(R.drawable.ic_favorite),
+ "button"
+ )
),
- action = actionRunCallback<ListTemplateItemAction>(
- actionParametersOf(ClickedKey to i)
- ),
+ action = itemSelectAction(actionParametersOf(ClickedKey to i)),
)
)
}
-
ListTemplate(
ListTemplateData(
- header = TemplateText("List Demo", TemplateText.Type.Title),
- headerIcon = TemplateImageWithDescription(
- ImageProvider(R.drawable.compose),
+ header = if (showHeader) TemplateText(
+ "List Demo",
+ TemplateText.Type.Title
+ ) else null,
+ headerIcon = if (showHeader) TemplateImageWithDescription(
+ ImageProvider(R.drawable.ic_widget),
"Logo"
- ),
- title = TemplateText("Title", TemplateText.Type.Title),
- button = TemplateTextButton(actionRunCallback<ListButtonAction>(), "Add item"),
+ ) else null,
+ button = if (showHeader && showHeaderAction) TemplateImageButton(
+ headerButtonAction(),
+ TemplateImageWithDescription(ImageProvider(R.drawable.ic_add), "Add item")
+ ) else null,
listContent = content,
- backgroundColor = ColorProvider(R.color.default_widget_background)
+ backgroundColor = ColorProvider(Color(0xDDD7E8CD)),
+ listStyle = listStyle
)
)
}
}
-class ListDemoWidgetReceiver : GlanceAppWidgetReceiver() {
- override val glanceAppWidget: GlanceAppWidget = ListDemoWidget()
+class DefaultNoopAction : ActionCallback {
+ override suspend fun onAction(
+ context: Context,
+ glanceId: GlanceId,
+ parameters: ActionParameters
+ ) {
+ }
}
-class ListButtonAction : ActionCallback {
+class ListAddButtonAction : ActionCallback {
override suspend fun onAction(
context: Context,
glanceId: GlanceId,
parameters: ActionParameters
) {
updateAppWidgetState(context, glanceId) { prefs ->
- var count = prefs[CountKey] ?: 0
+ var count = prefs[CountKey] ?: 1
if (count >= MAX_ITEMS) {
count = 0
if (prefs[ItemClickedKey] != 1) {
@@ -112,7 +211,7 @@
}
prefs[CountKey] = ++count
}
- ListDemoWidget().update(context, glanceId)
+ FullHeaderActionListDemoWidget().update(context, glanceId)
}
}
@@ -125,11 +224,11 @@
updateAppWidgetState(context, glanceId) {
it[ItemClickedKey] = parameters[ClickedKey] ?: -1
}
- ListDemoWidget().update(context, glanceId)
+ FullHeaderActionListDemoWidget().update(context, glanceId)
}
}
-private val CountKey = intPreferencesKey("item_count_key")
-private val ItemClickedKey = intPreferencesKey("item_clicked_key")
-private val ClickedKey = ActionParameters.Key<Int>("item_clicked_key")
-private const val MAX_ITEMS = 10
+val CountKey = intPreferencesKey("item_count_key")
+val ItemClickedKey = intPreferencesKey("item_clicked_key")
+val ClickedKey = ActionParameters.Key<Int>("item_clicked_key")
+const val MAX_ITEMS = 10
diff --git a/glance/glance-appwidget/integration-tests/template-demos/src/main/res/drawable-nodpi/ic_add.png b/glance/glance-appwidget/integration-tests/template-demos/src/main/res/drawable-nodpi/ic_add.png
new file mode 100644
index 0000000..f7cc82d
--- /dev/null
+++ b/glance/glance-appwidget/integration-tests/template-demos/src/main/res/drawable-nodpi/ic_add.png
Binary files differ
diff --git a/glance/glance-appwidget/integration-tests/template-demos/src/main/res/drawable-nodpi/ic_widget.png b/glance/glance-appwidget/integration-tests/template-demos/src/main/res/drawable-nodpi/ic_widget.png
new file mode 100644
index 0000000..172664b
--- /dev/null
+++ b/glance/glance-appwidget/integration-tests/template-demos/src/main/res/drawable-nodpi/ic_widget.png
Binary files differ
diff --git a/glance/glance-appwidget/integration-tests/template-demos/src/main/res/values/strings.xml b/glance/glance-appwidget/integration-tests/template-demos/src/main/res/values/strings.xml
index 2bf023a4..8277be9 100644
--- a/glance/glance-appwidget/integration-tests/template-demos/src/main/res/values/strings.xml
+++ b/glance/glance-appwidget/integration-tests/template-demos/src/main/res/values/strings.xml
@@ -26,4 +26,10 @@
<string name="template_data_saved_message">Saved</string>
<string name="background_error_high">Value out of range, using max</string>
<string name="background_error_low">Value out of range, using min</string>
+
+ <!-- Styles of the List Template widgets -->
+ <string name="list_style_with_header_action">List Template with header and action demo</string>
+ <string name="list_style_with_header">List Template with header demo</string>
+ <string name="list_style_no_header">List Template with no header demo</string>
+ <string name="list_style_brief">List Template with no header demo in brief info</string>
</resources>
diff --git a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/LayoutSelection.kt b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/LayoutSelection.kt
index 7a3c5fd..34c21c7 100644
--- a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/LayoutSelection.kt
+++ b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/LayoutSelection.kt
@@ -380,7 +380,7 @@
val childLayout = selectLayout33(type, modifier)
?: generatedContainers[ContainerSelector(
type,
- if (Build.VERSION.SDK_INT >= 33) 0 else numChildren,
+ numChildren,
horizontalAlignment,
verticalAlignment
)]?.layoutId
@@ -389,6 +389,7 @@
?: throw IllegalArgumentException("Cannot find generated children for $type")
return insertViewInternal(translationContext, childLayout, modifier)
.copy(children = childrenMapping)
+ .also { if (Build.VERSION.SDK_INT >= 33) removeAllViews(it.mainViewId) }
}
private fun Dimension.toSpecSize(): LayoutSize =
diff --git a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/GlanceAppWidgetTemplates.kt b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/GlanceAppWidgetTemplates.kt
index fedcdae..99844f7 100644
--- a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/GlanceAppWidgetTemplates.kt
+++ b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/GlanceAppWidgetTemplates.kt
@@ -32,15 +32,16 @@
import androidx.glance.layout.Column
import androidx.glance.layout.Row
import androidx.glance.layout.Spacer
+import androidx.glance.layout.fillMaxWidth
import androidx.glance.layout.height
import androidx.glance.layout.width
-import androidx.glance.text.Text
-import androidx.glance.text.TextStyle
import androidx.glance.template.TemplateButton
import androidx.glance.template.TemplateImageButton
import androidx.glance.template.TemplateImageWithDescription
import androidx.glance.template.TemplateText
import androidx.glance.template.TemplateTextButton
+import androidx.glance.text.Text
+import androidx.glance.text.TextStyle
/**
* Default header template layout implementation for AppWidgets, usually displayed at the top of the
@@ -48,16 +49,18 @@
*
* @param headerIcon glanceable main logo icon
* @param header main header text
+ * @param actionButton main header action button to the right side
*/
@Composable
internal fun AppWidgetTemplateHeader(
- headerIcon: TemplateImageWithDescription?,
- header: TemplateText?
+ headerIcon: TemplateImageWithDescription? = null,
+ header: TemplateText? = null,
+ actionButton: TemplateButton? = null,
) {
- if (headerIcon == null && header == null) return
+ if (headerIcon == null && header == null && actionButton == null) return
Row(
- modifier = GlanceModifier.background(Color.Transparent),
+ modifier = GlanceModifier.fillMaxWidth().background(Color.Transparent),
verticalAlignment = Alignment.CenterVertically
) {
headerIcon?.let {
@@ -71,7 +74,6 @@
if (headerIcon != null) {
Spacer(modifier = GlanceModifier.width(8.dp))
}
-
val size =
textSize(TemplateText.Type.Title, DisplaySize.fromDpSize(LocalSize.current))
Text(
@@ -81,6 +83,12 @@
maxLines = 1
)
}
+ actionButton?.let {
+ AppWidgetTemplateButton(
+ actionButton,
+ GlanceModifier.height(48.dp).width(48.dp)
+ )
+ }
}
}
@@ -112,9 +120,15 @@
/**
* Displays a [TemplateButton] for AppWidget layouts.
+ *
+ * @param button text or image button
+ * @param glanceModifier Glance modifier for further text or image button customization
*/
@Composable
-internal fun AppWidgetTemplateButton(button: TemplateButton) {
+internal fun AppWidgetTemplateButton(
+ button: TemplateButton,
+ glanceModifier: GlanceModifier = GlanceModifier
+) {
when (button) {
is TemplateImageButton -> {
// TODO: Specify sizing for image button
@@ -122,11 +136,11 @@
Image(
provider = image.image,
contentDescription = image.description,
- modifier = GlanceModifier.clickable(button.action)
+ modifier = glanceModifier.clickable(button.action)
)
}
is TemplateTextButton -> {
- Button(text = button.text, onClick = button.action)
+ Button(text = button.text, onClick = button.action, modifier = glanceModifier)
}
}
}
diff --git a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/ListTemplateLayouts.kt b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/ListTemplateLayouts.kt
index 3e5e5ae..deaa5f2 100644
--- a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/ListTemplateLayouts.kt
+++ b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/ListTemplateLayouts.kt
@@ -14,32 +14,35 @@
* limitations under the License.
*/
+@file:GlanceComposable
+
package androidx.glance.appwidget.template
import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
-import androidx.glance.Button
+import androidx.glance.GlanceComposable
import androidx.glance.GlanceModifier
import androidx.glance.Image
import androidx.glance.action.clickable
import androidx.glance.appwidget.lazy.LazyColumn
import androidx.glance.appwidget.lazy.itemsIndexed
import androidx.glance.background
+import androidx.glance.layout.Alignment
import androidx.glance.layout.Column
import androidx.glance.layout.Row
import androidx.glance.layout.Spacer
import androidx.glance.layout.fillMaxSize
-import androidx.glance.layout.fillMaxWidth
import androidx.glance.layout.height
import androidx.glance.layout.padding
import androidx.glance.layout.width
+import androidx.glance.template.ListStyle
import androidx.glance.template.ListTemplateData
import androidx.glance.template.LocalTemplateMode
import androidx.glance.template.TemplateMode
+import androidx.glance.text.FontWeight
import androidx.glance.text.Text
import androidx.glance.text.TextStyle
-import androidx.glance.unit.ColorProvider
/**
* Composable layout for a list template app widget. The template is optimized to display a list of
@@ -51,8 +54,8 @@
fun ListTemplate(data: ListTemplateData) {
when (LocalTemplateMode.current) {
TemplateMode.Collapsed -> WidgetLayoutCollapsed(data)
- TemplateMode.Vertical -> WidgetLayoutVertical(data)
- TemplateMode.Horizontal -> WidgetLayoutHorizontal(data)
+ TemplateMode.Vertical -> WidgetLayoutExpanded(data)
+ TemplateMode.Horizontal -> WidgetLayoutExpanded(data) // same as Vertical for the List view
}
}
@@ -60,57 +63,23 @@
@Composable
private fun WidgetLayoutCollapsed(data: ListTemplateData) {
- Column(modifier = createTopLevelModifier(data.backgroundColor)) {
- data.header?.let { header ->
- AppWidgetTemplateHeader(data.headerIcon, header)
- Spacer(modifier = GlanceModifier.height(16.dp))
+ Column(modifier = createTopLevelModifier(data)) {
+ if (data.listStyle == ListStyle.Full) {
+ AppWidgetTemplateHeader(data.headerIcon, data.header, data.button)
+ Spacer(modifier = GlanceModifier.height(4.dp))
}
- data.title?.let { title ->
- Text(title.text, style = TextStyle(fontSize = 20.sp))
- Spacer(modifier = GlanceModifier.height(16.dp))
- }
- data.button?.let { button ->
- Button(text = button.text, onClick = button.action)
- }
- }
-}
-
-@Composable
-private fun WidgetLayoutVertical(data: ListTemplateData) {
- Column(modifier = createTopLevelModifier(data.backgroundColor)) {
- data.header?.let { header ->
- AppWidgetTemplateHeader(data.headerIcon, header)
- Spacer(modifier = GlanceModifier.height(16.dp))
- }
- data.title?.let { title ->
- Text(title.text, style = TextStyle(fontSize = 20.sp))
- Spacer(modifier = GlanceModifier.height(16.dp))
- }
- data.button?.let { button ->
- Button(text = button.text, onClick = button.action)
- Spacer(modifier = GlanceModifier.height(16.dp))
- }
- LazyColumn {
- itemsIndexed(data.listContent) { _, item ->
- // TODO: Extract and allow override
- var itemModifier =
- GlanceModifier.fillMaxWidth().padding(bottom = 16.dp)
- item.action?.let { action -> itemModifier = itemModifier.clickable(action) }
- Row(modifier = itemModifier) {
- item.image?.let { image ->
- Image(provider = image.image,
- contentDescription = image.description,
- modifier = GlanceModifier.width(64.dp))
- }
- Spacer(modifier = GlanceModifier.width(16.dp))
- Column(modifier = GlanceModifier.defaultWeight()) {
- Text(item.title.text, style = TextStyle(fontSize = 18.sp), maxLines = 2)
- Spacer(modifier = GlanceModifier.height(8.dp))
- item.body?.let { body -> Text(body.text) }
- }
- item.button?.let { button ->
- Spacer(modifier = GlanceModifier.width(16.dp))
- AppWidgetTemplateButton(button)
+ data.listContent.firstOrNull()?.let { item ->
+ var itemModifier = GlanceModifier.fillMaxSize().padding(vertical = 8.dp)
+ item.action?.let { action -> itemModifier = itemModifier.clickable(action) }
+ Row(modifier = itemModifier) {
+ Column(modifier = GlanceModifier.defaultWeight()) {
+ Spacer(modifier = GlanceModifier.height(4.dp))
+ Text(item.title.text, style = TextStyle(fontSize = 18.sp), maxLines = 1)
+ if (data.listStyle == ListStyle.Full) {
+ item.body?.let { body ->
+ Spacer(modifier = GlanceModifier.height(4.dp))
+ Text(body.text, style = TextStyle(fontSize = 16.sp), maxLines = 2)
+ }
}
}
}
@@ -119,25 +88,69 @@
}
@Composable
-private fun WidgetLayoutHorizontal(data: ListTemplateData) {
- Column(modifier = createTopLevelModifier(data.backgroundColor)) {
- data.header?.let { header ->
- AppWidgetTemplateHeader(data.headerIcon, header)
+private fun WidgetLayoutExpanded(data: ListTemplateData) {
+ Column(modifier = createTopLevelModifier(data)) {
+ if (data.listStyle == ListStyle.Full) {
+ AppWidgetTemplateHeader(data.headerIcon, data.header, data.button)
Spacer(modifier = GlanceModifier.height(16.dp))
}
data.title?.let { title ->
Text(title.text, style = TextStyle(fontSize = 20.sp))
Spacer(modifier = GlanceModifier.height(16.dp))
}
- data.button?.let { button ->
- Button(text = button.text, onClick = button.action)
+ LazyColumn {
+ itemsIndexed(data.listContent) { _, item ->
+ // TODO: Extract and allow override
+ val itemSpacer = if (data.listStyle == ListStyle.Full) 8.dp else 0.dp
+ var itemModifier = GlanceModifier.fillMaxSize().padding(vertical = itemSpacer)
+ item.action?.let { action -> itemModifier = itemModifier.clickable(action) }
+ Row(
+ modifier = itemModifier,
+ verticalAlignment = Alignment.Vertical.CenterVertically,
+ ) {
+ if (data.listStyle == ListStyle.Full) {
+ item.image?.let { image ->
+ Image(
+ provider = image.image,
+ contentDescription = image.description,
+ )
+ Spacer(modifier = GlanceModifier.width(16.dp))
+ }
+ }
+ Column(
+ modifier = GlanceModifier.defaultWeight(),
+ verticalAlignment = Alignment.Vertical.CenterVertically
+ ) {
+ Text(
+ item.title.text,
+ style = TextStyle(fontWeight = FontWeight.Medium, fontSize = 18.sp),
+ maxLines = 1
+ )
+ if (data.listStyle == ListStyle.Full) {
+ item.body?.let { body ->
+ Text(body.text, style = TextStyle(fontSize = 16.sp), maxLines = 2)
+ }
+ }
+ if (data.listStyle == ListStyle.Full) {
+ item.label?.let { label ->
+ Spacer(modifier = GlanceModifier.height(4.dp))
+ Text(label.text)
+ }
+ }
+ }
+ item.button?.let { button ->
+ Spacer(modifier = GlanceModifier.width(16.dp))
+ AppWidgetTemplateButton(button)
+ }
+ }
+ }
}
}
}
-private fun createTopLevelModifier(backgroundColor: ColorProvider?): GlanceModifier {
+private fun createTopLevelModifier(data: ListTemplateData): GlanceModifier {
var modifier = GlanceModifier.fillMaxSize().padding(16.dp)
- backgroundColor?.let { color -> modifier = modifier.background(color) }
+ data.backgroundColor?.let { color -> modifier = modifier.background(color) }
return modifier
}
diff --git a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/SingleEntityTemplateLayouts.kt b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/SingleEntityTemplateLayouts.kt
index 6cfeb7d..ed17cce 100644
--- a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/SingleEntityTemplateLayouts.kt
+++ b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/template/SingleEntityTemplateLayouts.kt
@@ -56,7 +56,7 @@
@Composable
private fun WidgetLayoutCollapsed(data: SingleEntityTemplateData) {
- var modifier = GlanceModifier.fillMaxSize().padding(16.dp)
+ var modifier = GlanceModifier.fillMaxSize().padding(16.dp).background(Color.White)
data.image?.let { image ->
modifier = modifier.background(image.image, ContentScale.Crop)
@@ -70,7 +70,7 @@
@Composable
private fun WidgetLayoutVertical(data: SingleEntityTemplateData) {
- Column(modifier = GlanceModifier.fillMaxSize().padding(16.dp)) {
+ Column(modifier = GlanceModifier.fillMaxSize().padding(16.dp).background(Color.White)) {
data.headerIcon?.let { AppWidgetTemplateHeader(it, data.header) }
Spacer(modifier = GlanceModifier.height(16.dp))
data.image?.let { image ->
@@ -92,7 +92,7 @@
@Composable
private fun WidgetLayoutHorizontal(data: SingleEntityTemplateData) {
- Row(modifier = GlanceModifier.fillMaxSize().padding(16.dp)) {
+ Row(modifier = GlanceModifier.fillMaxSize().padding(16.dp).background(Color.White)) {
Column(
modifier =
GlanceModifier.fillMaxHeight().background(Color.Transparent).defaultWeight()
diff --git a/glance/glance/api/current.txt b/glance/glance/api/current.txt
index f584229..50713bd 100644
--- a/glance/glance/api/current.txt
+++ b/glance/glance/api/current.txt
@@ -378,33 +378,48 @@
property public final String title;
}
+ @kotlin.jvm.JvmInline public final value class ListStyle {
+ field public static final androidx.glance.template.ListStyle.Companion Companion;
+ }
+
+ public static final class ListStyle.Companion {
+ method public int getBrief();
+ method public int getFull();
+ property public final int Brief;
+ property public final int Full;
+ }
+
public final class ListTemplateData {
- ctor public ListTemplateData(androidx.glance.template.TemplateImageWithDescription headerIcon, optional java.util.List<androidx.glance.template.ListTemplateItem> listContent, optional androidx.glance.template.TemplateText? header, optional androidx.glance.template.TemplateText? title, optional androidx.glance.template.TemplateTextButton? button, optional androidx.glance.unit.ColorProvider? backgroundColor);
+ ctor public ListTemplateData(optional androidx.glance.template.TemplateImageWithDescription? headerIcon, optional java.util.List<androidx.glance.template.ListTemplateItem> listContent, optional androidx.glance.template.TemplateText? header, optional androidx.glance.template.TemplateText? title, optional androidx.glance.template.TemplateButton? button, optional androidx.glance.unit.ColorProvider? backgroundColor, optional int listStyle);
method public androidx.glance.unit.ColorProvider? getBackgroundColor();
- method public androidx.glance.template.TemplateTextButton? getButton();
+ method public androidx.glance.template.TemplateButton? getButton();
method public androidx.glance.template.TemplateText? getHeader();
- method public androidx.glance.template.TemplateImageWithDescription getHeaderIcon();
+ method public androidx.glance.template.TemplateImageWithDescription? getHeaderIcon();
method public java.util.List<androidx.glance.template.ListTemplateItem> getListContent();
+ method public int getListStyle();
method public androidx.glance.template.TemplateText? getTitle();
property public final androidx.glance.unit.ColorProvider? backgroundColor;
- property public final androidx.glance.template.TemplateTextButton? button;
+ property public final androidx.glance.template.TemplateButton? button;
property public final androidx.glance.template.TemplateText? header;
- property public final androidx.glance.template.TemplateImageWithDescription headerIcon;
+ property public final androidx.glance.template.TemplateImageWithDescription? headerIcon;
property public final java.util.List<androidx.glance.template.ListTemplateItem> listContent;
+ property public final int listStyle;
property public final androidx.glance.template.TemplateText? title;
}
public final class ListTemplateItem {
- ctor public ListTemplateItem(androidx.glance.template.TemplateText title, androidx.glance.template.TemplateText? body, androidx.glance.action.Action? action, androidx.glance.template.TemplateImageWithDescription? image, androidx.glance.template.TemplateButton? button);
+ ctor public ListTemplateItem(androidx.glance.template.TemplateText title, optional androidx.glance.template.TemplateText? body, optional androidx.glance.template.TemplateText? label, optional androidx.glance.action.Action? action, optional androidx.glance.template.TemplateImageWithDescription? image, optional androidx.glance.template.TemplateButton? button);
method public androidx.glance.action.Action? getAction();
method public androidx.glance.template.TemplateText? getBody();
method public androidx.glance.template.TemplateButton? getButton();
method public androidx.glance.template.TemplateImageWithDescription? getImage();
+ method public androidx.glance.template.TemplateText? getLabel();
method public androidx.glance.template.TemplateText getTitle();
property public final androidx.glance.action.Action? action;
property public final androidx.glance.template.TemplateText? body;
property public final androidx.glance.template.TemplateButton? button;
property public final androidx.glance.template.TemplateImageWithDescription? image;
+ property public final androidx.glance.template.TemplateText? label;
property public final androidx.glance.template.TemplateText title;
}
diff --git a/glance/glance/api/public_plus_experimental_current.txt b/glance/glance/api/public_plus_experimental_current.txt
index f584229..50713bd 100644
--- a/glance/glance/api/public_plus_experimental_current.txt
+++ b/glance/glance/api/public_plus_experimental_current.txt
@@ -378,33 +378,48 @@
property public final String title;
}
+ @kotlin.jvm.JvmInline public final value class ListStyle {
+ field public static final androidx.glance.template.ListStyle.Companion Companion;
+ }
+
+ public static final class ListStyle.Companion {
+ method public int getBrief();
+ method public int getFull();
+ property public final int Brief;
+ property public final int Full;
+ }
+
public final class ListTemplateData {
- ctor public ListTemplateData(androidx.glance.template.TemplateImageWithDescription headerIcon, optional java.util.List<androidx.glance.template.ListTemplateItem> listContent, optional androidx.glance.template.TemplateText? header, optional androidx.glance.template.TemplateText? title, optional androidx.glance.template.TemplateTextButton? button, optional androidx.glance.unit.ColorProvider? backgroundColor);
+ ctor public ListTemplateData(optional androidx.glance.template.TemplateImageWithDescription? headerIcon, optional java.util.List<androidx.glance.template.ListTemplateItem> listContent, optional androidx.glance.template.TemplateText? header, optional androidx.glance.template.TemplateText? title, optional androidx.glance.template.TemplateButton? button, optional androidx.glance.unit.ColorProvider? backgroundColor, optional int listStyle);
method public androidx.glance.unit.ColorProvider? getBackgroundColor();
- method public androidx.glance.template.TemplateTextButton? getButton();
+ method public androidx.glance.template.TemplateButton? getButton();
method public androidx.glance.template.TemplateText? getHeader();
- method public androidx.glance.template.TemplateImageWithDescription getHeaderIcon();
+ method public androidx.glance.template.TemplateImageWithDescription? getHeaderIcon();
method public java.util.List<androidx.glance.template.ListTemplateItem> getListContent();
+ method public int getListStyle();
method public androidx.glance.template.TemplateText? getTitle();
property public final androidx.glance.unit.ColorProvider? backgroundColor;
- property public final androidx.glance.template.TemplateTextButton? button;
+ property public final androidx.glance.template.TemplateButton? button;
property public final androidx.glance.template.TemplateText? header;
- property public final androidx.glance.template.TemplateImageWithDescription headerIcon;
+ property public final androidx.glance.template.TemplateImageWithDescription? headerIcon;
property public final java.util.List<androidx.glance.template.ListTemplateItem> listContent;
+ property public final int listStyle;
property public final androidx.glance.template.TemplateText? title;
}
public final class ListTemplateItem {
- ctor public ListTemplateItem(androidx.glance.template.TemplateText title, androidx.glance.template.TemplateText? body, androidx.glance.action.Action? action, androidx.glance.template.TemplateImageWithDescription? image, androidx.glance.template.TemplateButton? button);
+ ctor public ListTemplateItem(androidx.glance.template.TemplateText title, optional androidx.glance.template.TemplateText? body, optional androidx.glance.template.TemplateText? label, optional androidx.glance.action.Action? action, optional androidx.glance.template.TemplateImageWithDescription? image, optional androidx.glance.template.TemplateButton? button);
method public androidx.glance.action.Action? getAction();
method public androidx.glance.template.TemplateText? getBody();
method public androidx.glance.template.TemplateButton? getButton();
method public androidx.glance.template.TemplateImageWithDescription? getImage();
+ method public androidx.glance.template.TemplateText? getLabel();
method public androidx.glance.template.TemplateText getTitle();
property public final androidx.glance.action.Action? action;
property public final androidx.glance.template.TemplateText? body;
property public final androidx.glance.template.TemplateButton? button;
property public final androidx.glance.template.TemplateImageWithDescription? image;
+ property public final androidx.glance.template.TemplateText? label;
property public final androidx.glance.template.TemplateText title;
}
diff --git a/glance/glance/api/restricted_current.txt b/glance/glance/api/restricted_current.txt
index f584229..50713bd 100644
--- a/glance/glance/api/restricted_current.txt
+++ b/glance/glance/api/restricted_current.txt
@@ -378,33 +378,48 @@
property public final String title;
}
+ @kotlin.jvm.JvmInline public final value class ListStyle {
+ field public static final androidx.glance.template.ListStyle.Companion Companion;
+ }
+
+ public static final class ListStyle.Companion {
+ method public int getBrief();
+ method public int getFull();
+ property public final int Brief;
+ property public final int Full;
+ }
+
public final class ListTemplateData {
- ctor public ListTemplateData(androidx.glance.template.TemplateImageWithDescription headerIcon, optional java.util.List<androidx.glance.template.ListTemplateItem> listContent, optional androidx.glance.template.TemplateText? header, optional androidx.glance.template.TemplateText? title, optional androidx.glance.template.TemplateTextButton? button, optional androidx.glance.unit.ColorProvider? backgroundColor);
+ ctor public ListTemplateData(optional androidx.glance.template.TemplateImageWithDescription? headerIcon, optional java.util.List<androidx.glance.template.ListTemplateItem> listContent, optional androidx.glance.template.TemplateText? header, optional androidx.glance.template.TemplateText? title, optional androidx.glance.template.TemplateButton? button, optional androidx.glance.unit.ColorProvider? backgroundColor, optional int listStyle);
method public androidx.glance.unit.ColorProvider? getBackgroundColor();
- method public androidx.glance.template.TemplateTextButton? getButton();
+ method public androidx.glance.template.TemplateButton? getButton();
method public androidx.glance.template.TemplateText? getHeader();
- method public androidx.glance.template.TemplateImageWithDescription getHeaderIcon();
+ method public androidx.glance.template.TemplateImageWithDescription? getHeaderIcon();
method public java.util.List<androidx.glance.template.ListTemplateItem> getListContent();
+ method public int getListStyle();
method public androidx.glance.template.TemplateText? getTitle();
property public final androidx.glance.unit.ColorProvider? backgroundColor;
- property public final androidx.glance.template.TemplateTextButton? button;
+ property public final androidx.glance.template.TemplateButton? button;
property public final androidx.glance.template.TemplateText? header;
- property public final androidx.glance.template.TemplateImageWithDescription headerIcon;
+ property public final androidx.glance.template.TemplateImageWithDescription? headerIcon;
property public final java.util.List<androidx.glance.template.ListTemplateItem> listContent;
+ property public final int listStyle;
property public final androidx.glance.template.TemplateText? title;
}
public final class ListTemplateItem {
- ctor public ListTemplateItem(androidx.glance.template.TemplateText title, androidx.glance.template.TemplateText? body, androidx.glance.action.Action? action, androidx.glance.template.TemplateImageWithDescription? image, androidx.glance.template.TemplateButton? button);
+ ctor public ListTemplateItem(androidx.glance.template.TemplateText title, optional androidx.glance.template.TemplateText? body, optional androidx.glance.template.TemplateText? label, optional androidx.glance.action.Action? action, optional androidx.glance.template.TemplateImageWithDescription? image, optional androidx.glance.template.TemplateButton? button);
method public androidx.glance.action.Action? getAction();
method public androidx.glance.template.TemplateText? getBody();
method public androidx.glance.template.TemplateButton? getButton();
method public androidx.glance.template.TemplateImageWithDescription? getImage();
+ method public androidx.glance.template.TemplateText? getLabel();
method public androidx.glance.template.TemplateText getTitle();
property public final androidx.glance.action.Action? action;
property public final androidx.glance.template.TemplateText? body;
property public final androidx.glance.template.TemplateButton? button;
property public final androidx.glance.template.TemplateImageWithDescription? image;
+ property public final androidx.glance.template.TemplateText? label;
property public final androidx.glance.template.TemplateText title;
}
diff --git a/glance/glance/src/androidMain/kotlin/androidx/glance/template/ListTemplateData.kt b/glance/glance/src/androidMain/kotlin/androidx/glance/template/ListTemplateData.kt
index 23f0c26..9beb71d 100644
--- a/glance/glance/src/androidMain/kotlin/androidx/glance/template/ListTemplateData.kt
+++ b/glance/glance/src/androidMain/kotlin/androidx/glance/template/ListTemplateData.kt
@@ -22,20 +22,34 @@
/**
* The semantic data required to build List Template layouts.
*
- * @param headerIcon Logo icon, displayed in the glanceable header
- * @param listContent
- * @param header Main header text
- * @param title Text section main title
- * @param button Action button
- * @param backgroundColor Glanceable background color
+ * The data has a header for general information and a list of items defined by [ListTemplateItem].
+ * The header can have a header icon followed by header text and optionally an action button. No
+ * header would be shown if all header data are omitted.
+ *
+ * The data is independent of the layout presentation layer by each platform. For example, Glance
+ * AppWidget can put an action button in the header while Glance Tile might layout the button
+ * without a header. Only the level of data details can be indicated for use in the list style.
+ *
+ * @param headerIcon Logo icon displayed in the list header by [TemplateImageWithDescription].
+ * Default to no display when null valued.
+ * @param listContent List of items by [ListTemplateItem]. Default to empty list.
+ * @param header Main header text by [TemplateText]. Default to no display when null valued.
+ * @param title Text section title by [TemplateText] independent of header. Default to no display
+ * when null valued.
+ * @param button List action button by [TemplateButton] that can be a part of the header with its
+ * own icon image. Default to no display when null valued.
+ * @param backgroundColor Glanceable background color by [ColorProvider] for the whole list.
+ * Default to the system background color.
+ * @param listStyle The level of data details by [ListStyle]. Default to the [ListStyle.Full] level.
*/
class ListTemplateData(
- val headerIcon: TemplateImageWithDescription,
+ val headerIcon: TemplateImageWithDescription? = null,
val listContent: List<ListTemplateItem> = listOf(),
val header: TemplateText? = null,
val title: TemplateText? = null,
- val button: TemplateTextButton? = null,
- val backgroundColor: ColorProvider? = null
+ val button: TemplateButton? = null,
+ val backgroundColor: ColorProvider? = null,
+ val listStyle: ListStyle = ListStyle.Full
) {
override fun hashCode(): Int {
@@ -45,6 +59,7 @@
result = 31 * result + button.hashCode()
result = 31 * result + listContent.hashCode()
result = 31 * result + backgroundColor.hashCode()
+ result = 31 * result + listStyle.hashCode()
return result
}
@@ -60,32 +75,46 @@
if (button != other.button) return false
if (listContent != other.listContent) return false
if (backgroundColor != other.backgroundColor) return false
+ if (listStyle != other.listStyle) return false
return true
}
}
/**
- * The data required to display a list item
+ * The data required to display a list item.
*
- * @param title list item title text
- * @param body list item body text
- * @param action list item onClick action
- * @param image list item image
- * @param button Action button
+ * An item can have brief title with an icon, detailed body text, categorical label, and associated
+ * action button. The whole list item can also have a separate action such as item selection.
+ *
+ * The list style can indicate the level of details of what item elements to show deemed appropriate
+ * by developers. For example, Glance AppWidget developer might only show item icon when list header
+ * is displayed.
+ *
+ * @param title The list item title text by [TemplateText] with brief information.
+ * @param body The list item body text by [TemplateText] with detailed information. Default to no
+ * display when null valued.
+ * @param label The list item label text by [TemplateText]. Default to no display when null valued.
+ * @param action The list item onClick action by [Action]. Default to no action when null valued.
+ * @param image The list item icon image by [TemplateImageWithDescription]. Default to no display
+ * when null valued.
+ * @param button The item action button by [TemplateButton] that can have its own icon and action
+ * independent of item icon and item action. Default to no display when null valued.
*/
// TODO: Allow users to define a custom list item
class ListTemplateItem(
val title: TemplateText,
- val body: TemplateText?,
- val action: Action?,
- val image: TemplateImageWithDescription?,
- val button: TemplateButton?
+ val body: TemplateText? = null,
+ val label: TemplateText? = null,
+ val action: Action? = null,
+ val image: TemplateImageWithDescription? = null,
+ val button: TemplateButton? = null,
) {
override fun hashCode(): Int {
var result = title.hashCode()
result = 31 * result + (body?.hashCode() ?: 0)
+ result = 31 * result + (label?.hashCode() ?: 0)
result = 31 * result + (action?.hashCode() ?: 0)
result = 31 * result + (image?.hashCode() ?: 0)
result = 31 * result + (button?.hashCode() ?: 0)
@@ -100,6 +129,7 @@
if (title != other.title) return false
if (body != other.body) return false
+ if (label != other.label) return false
if (action != other.action) return false
if (image != other.image) return false
if (button != other.button) return false
@@ -107,3 +137,27 @@
return true
}
}
+
+/**
+ * The List Styles supported by the list template elements. Use as relative measure to developers on
+ * the level of data details and format deemed appropriate for each platform.
+ *
+ * For example, the Full style can refer to all data fields while the Brief style can refer to a
+ * compact form with only the list item title but no list header for Glance AppWidget. And for
+ * Glance Tile, the Full style might only make use of the header icon for the whole header while
+ * the Brief style shows no header.
+ */
+@JvmInline
+public value class ListStyle private constructor(private val value: Int) {
+ public companion object {
+ /**
+ * Show list data in full details relative to the platform.
+ */
+ public val Full: ListStyle = ListStyle(0)
+
+ /**
+ * Show list data in minimal details relative to the platform.
+ */
+ public val Brief: ListStyle = ListStyle(1)
+ }
+}
\ No newline at end of file
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 9d2653e..0cbbb70 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -770,15 +770,15 @@
</artifact>
</component>
<!-- Unsigned https://github.com/gradle/gradle/issues/20349 -->
- <component group="com.gradle" name="common-custom-user-data-gradle-plugin" version="1.6.5">
- <artifact name="common-custom-user-data-gradle-plugin-1.6.5.pom">
- <sha256 value="5f63192db4e0b9b71c8170e620f3e730efe87bfffa9a17943da0613eefb8ccf7"/>
+ <component group="com.gradle" name="common-custom-user-data-gradle-plugin" version="1.7.2">
+ <artifact name="common-custom-user-data-gradle-plugin-1.7.2.pom">
+ <sha256 value="c70db912c8b127b1b9a6c0cccac1a9353e9fc3b063a3be0114a5208f43c09c31" origin="Generated by Gradle"/>
</artifact>
</component>
<!-- Unsigned https://github.com/gradle/gradle/issues/20349 -->
- <component group="com.gradle" name="gradle-enterprise-gradle-plugin" version="3.10.1">
- <artifact name="gradle-enterprise-gradle-plugin-3.10.1.pom">
- <sha256 value="ea1e83983f25428c58ba647972d0bbb25180564ed7b16a7c7bf6445c3a1f7a12" origin="Generated by Gradle"/>
+ <component group="com.gradle" name="gradle-enterprise-gradle-plugin" version="3.10.2">
+ <artifact name="gradle-enterprise-gradle-plugin-3.10.2.pom">
+ <sha256 value="57603c9a75a9ef86ce30b1cb2db728d3cd9caf1be967343f1fc2316c85df5653" origin="Generated by Gradle"/>
</artifact>
</component>
<!-- Unsigned -->
diff --git a/gridlayout/gridlayout/src/androidTest/java/androidx/gridlayout/widget/TestContentView.java b/gridlayout/gridlayout/src/androidTest/java/androidx/gridlayout/widget/TestContentView.java
index 1d92ffd..f239831 100644
--- a/gridlayout/gridlayout/src/androidTest/java/androidx/gridlayout/widget/TestContentView.java
+++ b/gridlayout/gridlayout/src/androidTest/java/androidx/gridlayout/widget/TestContentView.java
@@ -20,11 +20,13 @@
import static org.hamcrest.MatcherAssert.assertThat;
import android.content.Context;
+import android.os.Build;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -47,6 +49,7 @@
super(context, attrs, defStyleAttr);
}
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@SuppressWarnings("unused")
public TestContentView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
diff --git a/leanback/leanback/build.gradle b/leanback/leanback/build.gradle
index dceed04..b7b7819 100644
--- a/leanback/leanback/build.gradle
+++ b/leanback/leanback/build.gradle
@@ -12,7 +12,7 @@
}
dependencies {
- api("androidx.annotation:annotation:1.1.0")
+ api("androidx.annotation:annotation:1.2.0")
api("androidx.interpolator:interpolator:1.0.0")
api("androidx.core:core:1.1.0")
api(project(":leanback:leanback-grid"))
diff --git a/leanback/leanback/src/main/java/androidx/leanback/transition/TransitionHelper.java b/leanback/leanback/src/main/java/androidx/leanback/transition/TransitionHelper.java
index d75c269..2fd3a9d 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/transition/TransitionHelper.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/transition/TransitionHelper.java
@@ -17,10 +17,13 @@
import android.animation.TimeInterpolator;
import android.annotation.SuppressLint;
+import android.app.Fragment;
+import android.app.FragmentTransaction;
import android.content.Context;
import android.graphics.Rect;
import android.os.Build;
import android.transition.AutoTransition;
+import android.transition.ChangeBounds;
import android.transition.ChangeTransform;
import android.transition.Fade;
import android.transition.Scene;
@@ -33,6 +36,9 @@
import android.view.Window;
import android.view.animation.AnimationUtils;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.util.ArrayList;
@@ -50,6 +56,7 @@
/**
* Returns true if system supports entrance Transition animations.
*/
+ @SuppressWarnings("BooleanMethodIsAlwaysInverted")
public static boolean systemSupportsEntranceTransitions() {
return Build.VERSION.SDK_INT >= 21;
}
@@ -61,87 +68,115 @@
}
}
- public static Object getSharedElementEnterTransition(Window window) {
+ @SuppressLint("ClassVerificationFailure")
+ @Nullable
+ public static Object getSharedElementEnterTransition(@NonNull Window window) {
if (Build.VERSION.SDK_INT >= 21) {
return window.getSharedElementEnterTransition();
}
return null;
}
- public static void setSharedElementEnterTransition(Window window, Object transition) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void setSharedElementEnterTransition(
+ @NonNull Window window,
+ @Nullable Object transition
+ ) {
if (Build.VERSION.SDK_INT >= 21) {
window.setSharedElementEnterTransition((Transition) transition);
}
}
- public static Object getSharedElementReturnTransition(Window window) {
+ @SuppressLint("ClassVerificationFailure")
+ @Nullable
+ public static Object getSharedElementReturnTransition(@NonNull Window window) {
if (Build.VERSION.SDK_INT >= 21) {
return window.getSharedElementReturnTransition();
}
return null;
}
- public static void setSharedElementReturnTransition(Window window, Object transition) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void setSharedElementReturnTransition(
+ @NonNull Window window,
+ @Nullable Object transition
+ ) {
if (Build.VERSION.SDK_INT >= 21) {
window.setSharedElementReturnTransition((Transition) transition);
}
}
- public static Object getSharedElementExitTransition(Window window) {
+ @SuppressLint("ClassVerificationFailure")
+ @Nullable
+ public static Object getSharedElementExitTransition(@NonNull Window window) {
if (Build.VERSION.SDK_INT >= 21) {
return window.getSharedElementExitTransition();
}
return null;
}
- public static Object getSharedElementReenterTransition(Window window) {
+ @SuppressLint("ClassVerificationFailure")
+ @Nullable
+ public static Object getSharedElementReenterTransition(@NonNull Window window) {
if (Build.VERSION.SDK_INT >= 21) {
return window.getSharedElementReenterTransition();
}
return null;
}
- public static Object getEnterTransition(Window window) {
+ @SuppressLint("ClassVerificationFailure")
+ @Nullable
+ public static Object getEnterTransition(@NonNull Window window) {
if (Build.VERSION.SDK_INT >= 21) {
return window.getEnterTransition();
}
return null;
}
- public static void setEnterTransition(Window window, Object transition) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void setEnterTransition(@NonNull Window window, @Nullable Object transition) {
if (Build.VERSION.SDK_INT >= 21) {
window.setEnterTransition((Transition) transition);
}
}
- public static Object getReturnTransition(Window window) {
+ @SuppressLint("ClassVerificationFailure")
+ @Nullable
+ public static Object getReturnTransition(@NonNull Window window) {
if (Build.VERSION.SDK_INT >= 21) {
return window.getReturnTransition();
}
return null;
}
- public static void setReturnTransition(Window window, Object transition) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void setReturnTransition(@NonNull Window window, @Nullable Object transition) {
if (Build.VERSION.SDK_INT >= 21) {
window.setReturnTransition((Transition) transition);
}
}
- public static Object getExitTransition(Window window) {
+ @SuppressLint("ClassVerificationFailure")
+ @Nullable
+ public static Object getExitTransition(@NonNull Window window) {
if (Build.VERSION.SDK_INT >= 21) {
return window.getExitTransition();
}
return null;
}
- public static Object getReenterTransition(Window window) {
+ @SuppressLint("ClassVerificationFailure")
+ @Nullable
+ public static Object getReenterTransition(@NonNull Window window) {
if (Build.VERSION.SDK_INT >= 21) {
return window.getReenterTransition();
}
return null;
}
- public static Object createScene(ViewGroup sceneRoot, Runnable r) {
+ @SuppressLint("ClassVerificationFailure")
+ @Nullable
+ public static Object createScene(@NonNull ViewGroup sceneRoot, @Nullable Runnable r) {
if (Build.VERSION.SDK_INT >= 19) {
Scene scene = new Scene(sceneRoot);
scene.setEnterAction(r);
@@ -150,6 +185,8 @@
return r;
}
+ @SuppressLint("ClassVerificationFailure")
+ @NonNull
public static Object createChangeBounds(boolean reparent) {
if (Build.VERSION.SDK_INT >= 19) {
CustomChangeBounds changeBounds = new CustomChangeBounds();
@@ -159,6 +196,8 @@
return new TransitionStub();
}
+ @SuppressLint("ClassVerificationFailure")
+ @NonNull
public static Object createChangeTransform() {
if (Build.VERSION.SDK_INT >= 21) {
return new ChangeTransform();
@@ -166,31 +205,48 @@
return new TransitionStub();
}
- public static void setChangeBoundsStartDelay(Object changeBounds, View view, int startDelay) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void setChangeBoundsStartDelay(
+ @NonNull Object changeBounds,
+ @NonNull View view,
+ int startDelay
+ ) {
if (Build.VERSION.SDK_INT >= 19) {
((CustomChangeBounds) changeBounds).setStartDelay(view, startDelay);
}
}
- public static void setChangeBoundsStartDelay(Object changeBounds, int viewId, int startDelay) {
+ public static void setChangeBoundsStartDelay(
+ @NonNull Object changeBounds,
+ int viewId,
+ int startDelay
+ ) {
if (Build.VERSION.SDK_INT >= 19) {
((CustomChangeBounds) changeBounds).setStartDelay(viewId, startDelay);
}
}
- public static void setChangeBoundsStartDelay(Object changeBounds, String className,
- int startDelay) {
+ public static void setChangeBoundsStartDelay(
+ @NonNull Object changeBounds,
+ @NonNull String className,
+ int startDelay
+ ) {
if (Build.VERSION.SDK_INT >= 19) {
((CustomChangeBounds) changeBounds).setStartDelay(className, startDelay);
}
}
- public static void setChangeBoundsDefaultStartDelay(Object changeBounds, int startDelay) {
+ public static void setChangeBoundsDefaultStartDelay(
+ @NonNull Object changeBounds,
+ int startDelay
+ ) {
if (Build.VERSION.SDK_INT >= 19) {
((CustomChangeBounds) changeBounds).setDefaultStartDelay(startDelay);
}
}
+ @SuppressLint("ClassVerificationFailure")
+ @NonNull
public static Object createTransitionSet(boolean sequential) {
if (Build.VERSION.SDK_INT >= 19) {
TransitionSet set = new TransitionSet();
@@ -201,6 +257,7 @@
return new TransitionStub();
}
+ @NonNull
public static Object createSlide(int slideEdge) {
if (Build.VERSION.SDK_INT >= 19) {
SlideKitkat slide = new SlideKitkat();
@@ -210,6 +267,8 @@
return new TransitionStub();
}
+ @SuppressLint("ClassVerificationFailure")
+ @NonNull
public static Object createScale() {
if (Build.VERSION.SDK_INT >= 21) {
return new ChangeTransform();
@@ -220,60 +279,79 @@
return new TransitionStub();
}
- public static void addTransition(Object transitionSet, Object transition) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void addTransition(@NonNull Object transitionSet, @NonNull Object transition) {
if (Build.VERSION.SDK_INT >= 19) {
((TransitionSet) transitionSet).addTransition((Transition) transition);
}
}
- public static void exclude(Object transition, int targetId, boolean exclude) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void exclude(@NonNull Object transition, int targetId, boolean exclude) {
if (Build.VERSION.SDK_INT >= 19) {
((Transition) transition).excludeTarget(targetId, exclude);
}
}
- public static void exclude(Object transition, View targetView, boolean exclude) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void exclude(
+ @NonNull Object transition,
+ @NonNull View targetView,
+ boolean exclude
+ ) {
if (Build.VERSION.SDK_INT >= 19) {
((Transition) transition).excludeTarget(targetView, exclude);
}
}
- public static void excludeChildren(Object transition, int targetId, boolean exclude) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void excludeChildren(@NonNull Object transition, int targetId, boolean exclude) {
if (Build.VERSION.SDK_INT >= 19) {
((Transition) transition).excludeChildren(targetId, exclude);
}
}
- public static void excludeChildren(Object transition, View targetView, boolean exclude) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void excludeChildren(
+ @NonNull Object transition,
+ @NonNull View targetView,
+ boolean exclude
+ ) {
if (Build.VERSION.SDK_INT >= 19) {
((Transition) transition).excludeChildren(targetView, exclude);
}
}
- public static void include(Object transition, int targetId) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void include(@NonNull Object transition, int targetId) {
if (Build.VERSION.SDK_INT >= 19) {
((Transition) transition).addTarget(targetId);
}
}
- public static void include(Object transition, View targetView) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void include(@NonNull Object transition, @NonNull View targetView) {
if (Build.VERSION.SDK_INT >= 19) {
((Transition) transition).addTarget(targetView);
}
}
- public static void setStartDelay(Object transition, long startDelay) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void setStartDelay(@NonNull Object transition, long startDelay) {
if (Build.VERSION.SDK_INT >= 19) {
((Transition) transition).setStartDelay(startDelay);
}
}
- public static void setDuration(Object transition, long duration) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void setDuration(@NonNull Object transition, long duration) {
if (Build.VERSION.SDK_INT >= 19) {
((Transition) transition).setDuration(duration);
}
}
+ @SuppressLint("ClassVerificationFailure")
+ @NonNull
public static Object createAutoTransition() {
if (Build.VERSION.SDK_INT >= 19) {
return new AutoTransition();
@@ -281,6 +359,8 @@
return new TransitionStub();
}
+ @SuppressLint("ClassVerificationFailure")
+ @NonNull
public static Object createFadeTransition(int fadeMode) {
if (Build.VERSION.SDK_INT >= 19) {
return new Fade(fadeMode);
@@ -288,7 +368,11 @@
return new TransitionStub();
}
- public static void addTransitionListener(Object transition, final TransitionListener listener) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void addTransitionListener(
+ @NonNull Object transition,
+ final @Nullable TransitionListener listener
+ ) {
if (listener == null) {
return;
}
@@ -330,7 +414,11 @@
}
}
- public static void removeTransitionListener(Object transition, TransitionListener listener) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void removeTransitionListener(
+ @NonNull Object transition,
+ @Nullable TransitionListener listener
+ ) {
if (Build.VERSION.SDK_INT >= 19) {
if (listener == null || listener.mImpl == null) {
return;
@@ -346,7 +434,8 @@
}
}
- public static void runTransition(Object scene, Object transition) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void runTransition(@Nullable Object scene, @Nullable Object transition) {
if (Build.VERSION.SDK_INT >= 19) {
TransitionManager.go((Scene) scene, (Transition) transition);
} else {
@@ -368,19 +457,26 @@
}
}
- public static void setInterpolator(Object transition, Object timeInterpolator) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void setInterpolator(
+ @NonNull Object transition,
+ @Nullable Object timeInterpolator
+ ) {
if (Build.VERSION.SDK_INT >= 19) {
((Transition) transition).setInterpolator((TimeInterpolator) timeInterpolator);
}
}
- public static void addTarget(Object transition, View view) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void addTarget(@NonNull Object transition, @NonNull View view) {
if (Build.VERSION.SDK_INT >= 19) {
((Transition) transition).addTarget(view);
}
}
- public static Object createDefaultInterpolator(Context context) {
+ @SuppressLint("ClassVerificationFailure")
+ @Nullable
+ public static Object createDefaultInterpolator(@NonNull Context context) {
if (Build.VERSION.SDK_INT >= 21) {
return AnimationUtils.loadInterpolator(context,
android.R.interpolator.fast_out_linear_in);
@@ -388,43 +484,58 @@
return null;
}
- public static Object loadTransition(Context context, int resId) {
+ @SuppressLint("ClassVerificationFailure")
+ @NonNull
+ public static Object loadTransition(@NonNull Context context, int resId) {
if (Build.VERSION.SDK_INT >= 19) {
return TransitionInflater.from(context).inflateTransition(resId);
}
return new TransitionStub();
}
- @SuppressLint("ReferencesDeprecated")
- public static void setEnterTransition(android.app.Fragment fragment, Object transition) {
+ @SuppressLint({"ReferencesDeprecated", "ClassVerificationFailure"})
+ public static void setEnterTransition(
+ @NonNull Fragment fragment,
+ @Nullable Object transition
+ ) {
if (Build.VERSION.SDK_INT >= 21) {
fragment.setEnterTransition((Transition) transition);
}
}
- @SuppressLint("ReferencesDeprecated")
- public static void setExitTransition(android.app.Fragment fragment, Object transition) {
+ @SuppressLint({"ReferencesDeprecated", "ClassVerificationFailure"})
+ public static void setExitTransition(
+ @NonNull Fragment fragment,
+ @Nullable Object transition
+ ) {
if (Build.VERSION.SDK_INT >= 21) {
fragment.setExitTransition((Transition) transition);
}
}
- @SuppressLint("ReferencesDeprecated")
- public static void setSharedElementEnterTransition(android.app.Fragment fragment,
- Object transition) {
+ @SuppressLint({"ReferencesDeprecated", "ClassVerificationFailure"})
+ public static void setSharedElementEnterTransition(
+ @NonNull Fragment fragment,
+ @Nullable Object transition
+ ) {
if (Build.VERSION.SDK_INT >= 21) {
fragment.setSharedElementEnterTransition((Transition) transition);
}
}
- @SuppressLint("ReferencesDeprecated")
- public static void addSharedElement(android.app.FragmentTransaction ft,
- View view, String transitionName) {
+ @SuppressLint({"ReferencesDeprecated", "ClassVerificationFailure"})
+ public static void addSharedElement(
+ @NonNull FragmentTransaction ft,
+ @NonNull View view,
+ @NonNull String transitionName
+ ) {
if (Build.VERSION.SDK_INT >= 21) {
ft.addSharedElement(view, transitionName);
}
}
+ @SuppressLint("ClassVerificationFailure")
+ @NonNull
public static Object createFadeAndShortSlide(int edge) {
if (Build.VERSION.SDK_INT >= 21) {
return new FadeAndShortSlide(edge);
@@ -432,6 +543,8 @@
return new TransitionStub();
}
+ @SuppressLint("ClassVerificationFailure")
+ @NonNull
public static Object createFadeAndShortSlide(int edge, float distance) {
if (Build.VERSION.SDK_INT >= 21) {
FadeAndShortSlide slide = new FadeAndShortSlide(edge);
@@ -441,21 +554,29 @@
return new TransitionStub();
}
- public static void beginDelayedTransition(ViewGroup sceneRoot, Object transitionObject) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void beginDelayedTransition(
+ @NonNull ViewGroup sceneRoot,
+ @Nullable Object transitionObject
+ ) {
if (Build.VERSION.SDK_INT >= 21) {
Transition transition = (Transition) transitionObject;
TransitionManager.beginDelayedTransition(sceneRoot, transition);
}
}
- public static void setTransitionGroup(ViewGroup viewGroup, boolean transitionGroup) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void setTransitionGroup(@NonNull ViewGroup viewGroup, boolean transitionGroup) {
if (Build.VERSION.SDK_INT >= 21) {
viewGroup.setTransitionGroup(transitionGroup);
}
}
- public static void setEpicenterCallback(Object transition,
- final TransitionEpicenterCallback callback) {
+ @SuppressLint("ClassVerificationFailure")
+ public static void setEpicenterCallback(
+ @NonNull Object transition,
+ @Nullable final TransitionEpicenterCallback callback
+ ) {
if (Build.VERSION.SDK_INT >= 21) {
if (callback == null) {
((Transition) transition).setEpicenterCallback(null);
diff --git a/libraryversions.toml b/libraryversions.toml
index 44bc815..d93679a 100644
--- a/libraryversions.toml
+++ b/libraryversions.toml
@@ -94,7 +94,7 @@
SECURITY_APP_AUTHENTICATOR_TESTING = "1.0.0-alpha02"
SECURITY_BIOMETRIC = "1.0.0-alpha01"
SECURITY_IDENTITY_CREDENTIAL = "1.0.0-alpha04"
-SHARETARGET = "1.3.0-alpha01"
+SHARETARGET = "1.2.0-rc02"
SLICE = "1.1.0-alpha02"
SLICE_BENCHMARK = "1.1.0-alpha02"
SLICE_BUILDERS_KTX = "1.0.0-alpha08"
diff --git a/lifecycle/lifecycle-common/api/restricted_current.txt b/lifecycle/lifecycle-common/api/restricted_current.txt
index 19ccca0..cdf6954 100644
--- a/lifecycle/lifecycle-common/api/restricted_current.txt
+++ b/lifecycle/lifecycle-common/api/restricted_current.txt
@@ -65,7 +65,7 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class MethodCallsLogger {
ctor public MethodCallsLogger();
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public boolean approveCall(String!, int);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public boolean approveCall(String, int);
}
@Deprecated @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target(java.lang.annotation.ElementType.METHOD) public @interface OnLifecycleEvent {
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/MethodCallsLogger.java b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/MethodCallsLogger.java
index f091d87..d72a3ac 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/MethodCallsLogger.java
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/MethodCallsLogger.java
@@ -16,6 +16,7 @@
package androidx.lifecycle;
+import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import java.util.HashMap;
@@ -32,7 +33,7 @@
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
- public boolean approveCall(String name, int type) {
+ public boolean approveCall(@NonNull String name, int type) {
Integer nullableMask = mCalledMethods.get(name);
int mask = nullableMask != null ? nullableMask : 0;
boolean wasCalled = (mask & type) != 0;
diff --git a/lint-checks/integration-tests/src/main/java/androidx/IdeaSuppressionJava.java b/lint-checks/integration-tests/src/main/java/androidx/IdeaSuppressionJava.java
deleted file mode 100644
index 390bf2b..0000000
--- a/lint-checks/integration-tests/src/main/java/androidx/IdeaSuppressionJava.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2021 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 androidx;
-
-/**
- * Java usage of inline suppression.
- */
-@SuppressWarnings("unused")
-public class IdeaSuppressionJava {
-
- /**
- * Call to a deprecated method with an inline suppression.
- */
- public void callDeprecatedMethod() {
- //noinspection deprecation
- deprecatedMethod();
-
- notDeprecatedMethod();
- }
-
- /**
- * This method is deprecated.
- *
- * @deprecated Replaced with {@link #notDeprecatedMethod()}
- */
- @Deprecated
- public void deprecatedMethod() {}
-
- /**
- * This method is not deprecated.
- */
- public void notDeprecatedMethod() {}
-
-}
diff --git a/lint-checks/integration-tests/src/main/java/androidx/IdeaSuppressionKotlin.kt b/lint-checks/integration-tests/src/main/java/androidx/IdeaSuppressionKotlin.kt
deleted file mode 100644
index abd0612..0000000
--- a/lint-checks/integration-tests/src/main/java/androidx/IdeaSuppressionKotlin.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2021 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 androidx
-
-// Suppress deprecation warning as it generates false positives when running project lint checks.
-// This is OK as the tests check for usage of `//noinspection deprecation`.
-@Suppress("unused", "DEPRECATION")
-class IdeaSuppressionKotlin {
- /**
- * Call to a deprecated method with an inline suppression.
- */
- fun callDeprecatedMethod() {
- //noinspection deprecation
- deprecatedMethod()
-
- notDeprecatedMethod()
- }
-
- /**
- * This method is deprecated.
- */
- @Deprecated("Replaced with {@link #notDeprecatedMethod()}")
- fun deprecatedMethod() {
- }
-
- /**
- * This method is not deprecated.
- */
- fun notDeprecatedMethod() {}
-}
\ No newline at end of file
diff --git a/lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsJava.java b/lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsJava.java
deleted file mode 100644
index 4f32ad8..0000000
--- a/lint-checks/integration-tests/src/main/java/androidx/NullabilityAnnotationsJava.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2022 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 androidx.sample;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Sample class for testing JetBrains nullability annotations.
- */
-@SuppressWarnings("unused")
-public class NullabilityAnnotationsJava {
- /**
- * Sample method
- * @param arg NotNull arg
- */
- private void method1(@NotNull String arg) {
- }
-
- /**
- * Sample method
- * @param arg Nullable arg
- */
- private void method2(@Nullable String arg) {
- }
-}
diff --git a/lint-checks/integration-tests/src/main/java/androidx/Sample.java b/lint-checks/integration-tests/src/main/java/androidx/Sample.java
deleted file mode 100644
index 7c396ca..0000000
--- a/lint-checks/integration-tests/src/main/java/androidx/Sample.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2021 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 androidx;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Sample class used to verify that ConcurrentHashMap lint check is running.
- */
-@SuppressWarnings("unused")
-public class Sample {
-
- /**
- * This function does not specify the nullability of its return type.
- * Lint should catch this and report an error.
- * If Lint does not catch this, then Lint's intrinsic checks are not running
- */
- public static Sample confirmIntrinisicLintChecksRun() {
- return null;
- }
-
- /**
- * This function uses a disallowed annotation
- * Lint should catch this and report an error.
- * If Lint does not catch this, then our AndroidX-specific checks are not running
- */
- public static void confirmCustomAndroidXChecksRun(ConcurrentHashMap m) {
- }
-
- private Sample() {
- }
-}
diff --git a/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt b/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt
index 9469d07..3a50f64 100644
--- a/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt
+++ b/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt
@@ -41,8 +41,11 @@
AndroidManifestServiceExportedDetector.ISSUE,
BanParcelableUsage.ISSUE,
BanConcurrentHashMap.ISSUE,
- BanInappropriateExperimentalUsage.ISSUE,
- BanInappropriateExperimentalUsage.NULL_ANNOTATION_GROUP_ISSUE,
+
+ // Reenable after b/235251897 is resolved
+// BanInappropriateExperimentalUsage.ISSUE,
+// BanInappropriateExperimentalUsage.NULL_ANNOTATION_GROUP_ISSUE,
+
BanInlineOptIn.ISSUE,
BanKeepAnnotation.ISSUE,
TargetApiAnnotationUsageDetector.ISSUE,
diff --git a/lint-checks/src/test/java/androidx/build/lint/IdeaSuppressionDetectorTest.kt b/lint-checks/src/test/java/androidx/build/lint/IdeaSuppressionDetectorTest.kt
index 0e7cb12..702c6088 100644
--- a/lint-checks/src/test/java/androidx/build/lint/IdeaSuppressionDetectorTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/IdeaSuppressionDetectorTest.kt
@@ -30,37 +30,71 @@
@Test
fun `Detection of IDEA-specific suppression in Java sources`() {
- val input = arrayOf(
- javaSample("androidx.IdeaSuppressionJava")
+ val input = java(
+ "src/androidx/IdeaSuppressionJava.java",
+ """
+ public class IdeaSuppressionJava {
+
+ // Call to a deprecated method with an inline suppression.
+ public void callDeprecatedMethod() {
+ //noinspection deprecation
+ deprecatedMethod();
+
+ notDeprecatedMethod();
+ }
+
+ @Deprecated
+ public void deprecatedMethod() {}
+
+ public void notDeprecatedMethod() {}
+ }
+ """.trimIndent()
)
/* ktlint-disable max-line-length */
val expected = """
-src/androidx/IdeaSuppressionJava.java:29: Error: Uses IntelliJ-specific suppression, should use @SuppressWarnings("deprecation") [IdeaSuppression]
+src/androidx/IdeaSuppressionJava.java:5: Error: Uses IntelliJ-specific suppression, should use @SuppressWarnings("deprecation") [IdeaSuppression]
//noinspection deprecation
~~~~~~~~~~~~~~~~~~~~~~~~~~
1 errors, 0 warnings
""".trimIndent()
/* ktlint-enable max-line-length */
- check(*input).expect(expected)
+ check(input).expect(expected)
}
@Test
fun `Detection of IDEA-specific suppression in Kotlin sources`() {
- val input = arrayOf(
- ktSample("androidx.IdeaSuppressionKotlin")
+ val input = kotlin(
+ "src/androidx/IdeaSuppressionKotlin.kt",
+ """
+ class IdeaSuppressionKotlin {
+
+ // Call to a deprecated method with an inline suppression.
+ fun callDeprecatedMethod() {
+ //noinspection deprecation
+ deprecatedMethod()
+
+ notDeprecatedMethod()
+ }
+
+ @Deprecated("Replaced with {@link #notDeprecatedMethod()}")
+ fun deprecatedMethod() {}
+
+ fun notDeprecatedMethod() {}
+ }
+ """.trimIndent()
)
/* ktlint-disable max-line-length */
val expected = """
-src/androidx/IdeaSuppressionKotlin.kt:27: Error: Uses IntelliJ-specific suppression, should use @SuppressWarnings("deprecation") [IdeaSuppression]
+src/androidx/IdeaSuppressionKotlin.kt:5: Error: Uses IntelliJ-specific suppression, should use @SuppressWarnings("deprecation") [IdeaSuppression]
//noinspection deprecation
~~~~~~~~~~~~~~~~~~~~~~~~~~
1 errors, 0 warnings
""".trimIndent()
/* ktlint-enable max-line-length */
- check(*input).expect(expected)
+ check(input).expect(expected)
}
}
diff --git a/lint-checks/src/test/java/androidx/build/lint/NullabilityAnnotationsDetectorTest.kt b/lint-checks/src/test/java/androidx/build/lint/NullabilityAnnotationsDetectorTest.kt
index c9c423c..681f5ba 100644
--- a/lint-checks/src/test/java/androidx/build/lint/NullabilityAnnotationsDetectorTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/NullabilityAnnotationsDetectorTest.kt
@@ -25,32 +25,48 @@
class NullabilityAnnotationsDetectorTest : AbstractLintDetectorTest(
useDetector = NullabilityAnnotationsDetector(),
useIssues = listOf(NullabilityAnnotationsDetector.ISSUE),
- ) {
+) {
@Test
fun `Detection of Jetbrains nullability usage in Java sources`() {
+ val source = java(
+ "src/androidx/sample/NullabilityAnnotationsJava.java",
+ """
+ import org.jetbrains.annotations.NotNull;
+ import org.jetbrains.annotations.Nullable;
+
+ public class NullabilityAnnotationsJava {
+ private void method1(@NotNull String arg) {
+ }
+
+ private void method2(@Nullable String arg) {
+ }
+ }
+ """.trimIndent()
+ )
+
val input = arrayOf(
- javaSample("androidx.NullabilityAnnotationsJava"),
+ source,
JetBrainsAnnotations
)
/* ktlint-disable max-line-length */
val expected = """
-src/androidx/sample/NullabilityAnnotationsJava.java:31: Error: Use @androidx.annotation.NonNull instead of @org.jetbrains.annotations.NotNull [NullabilityAnnotationsDetector]
+src/androidx/sample/NullabilityAnnotationsJava.java:5: Error: Use @androidx.annotation.NonNull instead of @org.jetbrains.annotations.NotNull [NullabilityAnnotationsDetector]
private void method1(@NotNull String arg) {
~~~~~~~~
-src/androidx/sample/NullabilityAnnotationsJava.java:38: Error: Use @androidx.annotation.Nullable instead of @org.jetbrains.annotations.Nullable [NullabilityAnnotationsDetector]
+src/androidx/sample/NullabilityAnnotationsJava.java:8: Error: Use @androidx.annotation.Nullable instead of @org.jetbrains.annotations.Nullable [NullabilityAnnotationsDetector]
private void method2(@Nullable String arg) {
~~~~~~~~~
2 errors, 0 warnings
""".trimIndent()
val expectFixDiffs = """
-Autofix for src/androidx/sample/NullabilityAnnotationsJava.java line 31: Replace with `@androidx.annotation.NonNull`:
-@@ -31 +31
+Autofix for src/androidx/sample/NullabilityAnnotationsJava.java line 5: Replace with `@androidx.annotation.NonNull`:
+@@ -5 +5
- private void method1(@NotNull String arg) {
+ private void method1(@androidx.annotation.NonNull String arg) {
-Autofix for src/androidx/sample/NullabilityAnnotationsJava.java line 38: Replace with `@androidx.annotation.Nullable`:
-@@ -38 +38
+Autofix for src/androidx/sample/NullabilityAnnotationsJava.java line 8: Replace with `@androidx.annotation.Nullable`:
+@@ -8 +8
- private void method2(@Nullable String arg) {
+ private void method2(@androidx.annotation.Nullable String arg) {
""".trimIndent()
@@ -63,8 +79,21 @@
@Test
fun `JetBrains annotations allowed in Kotlin sources`() {
+ val source = kotlin(
+ """
+ import org.jetbrains.annotations.NotNull
+ import org.jetbrains.annotations.Nullable
+
+ class NullabilityAnnotationsKotlin {
+ private fun method1(@NotNull arg: String) {}
+
+ private fun method2(@Nullable arg: String?) {}
+ }
+ """.trimIndent()
+ )
+
val input = arrayOf(
- ktSample("androidx.NullabilityAnnotationsKotlin"),
+ source,
JetBrainsAnnotations
)
check(*input).expectClean()
diff --git a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaBrowserCallbackTest.java b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaBrowserCallbackTest.java
index 33424bc..1124000 100644
--- a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaBrowserCallbackTest.java
+++ b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaBrowserCallbackTest.java
@@ -38,7 +38,9 @@
import static junit.framework.Assert.fail;
import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assume.assumeTrue;
+import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
@@ -61,6 +63,7 @@
import androidx.test.filters.LargeTest;
import androidx.versionedparcelable.ParcelUtils;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -84,6 +87,15 @@
public class MediaBrowserCallbackTest extends MediaControllerCallbackTest {
private static final String TAG = "MediaBrowserCallbackTest";
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ // b/230354064
+ assumeTrue(Build.VERSION.SDK_INT != 17);
+
+ super.setUp();
+ }
+
@Override
MediaController onCreateController(@NonNull final SessionToken token,
@Nullable final Bundle connectionHints, @Nullable final TestBrowserCallback callback)
diff --git a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerCallbackTest.java b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerCallbackTest.java
index 8a7aaf3..11ca66e 100644
--- a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerCallbackTest.java
+++ b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerCallbackTest.java
@@ -33,6 +33,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
import android.graphics.Bitmap;
import android.media.AudioManager;
@@ -133,6 +134,9 @@
@Test
public void connection_toLibraryService() throws InterruptedException {
+ // See b/230354064
+ assumeTrue(Build.VERSION.SDK_INT != 17);
+
SessionToken token = new SessionToken(mContext, MOCK_MEDIA2_LIBRARY_SERVICE);
MediaController controller = createController(token);
assertNotNull(controller);
@@ -180,6 +184,9 @@
@Test
@LargeTest
public void connection_withLongPlaylist() throws InterruptedException {
+ // See b/230354064
+ assumeTrue(Build.VERSION.SDK_INT != 17);
+
final int playlistSize = 5000;
mRemoteSession2.getMockPlayer().createAndSetFakePlaylist(playlistSize);
diff --git a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerCompatCallbackWithMediaSessionTest.java b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerCompatCallbackWithMediaSessionTest.java
index 2398a13..c67cf4c 100644
--- a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerCompatCallbackWithMediaSessionTest.java
+++ b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerCompatCallbackWithMediaSessionTest.java
@@ -19,6 +19,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
import android.media.AudioManager;
import android.os.Build;
@@ -80,6 +81,9 @@
@Before
@Override
public void setUp() throws Exception {
+ // b/230354064
+ assumeTrue(Build.VERSION.SDK_INT != 17);
+
super.setUp();
mSession = new RemoteMediaSession(TAG, mContext, null);
mControllerCompat = new MediaControllerCompat(mContext, mSession.getCompatToken());
@@ -89,7 +93,9 @@
@Override
public void cleanUp() throws Exception {
super.cleanUp();
- mSession.close();
+ if (mSession != null) {
+ mSession.close();
+ }
}
@Ignore("b/202942942")
diff --git a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerLegacyTest.java b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerLegacyTest.java
index 9152025..e3b8826 100644
--- a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerLegacyTest.java
+++ b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerLegacyTest.java
@@ -27,6 +27,7 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
import android.app.PendingIntent;
import android.content.Context;
@@ -97,6 +98,9 @@
@Before
@Override
public void setUp() throws Exception {
+ // b/230354064
+ assumeTrue(Build.VERSION.SDK_INT != 17);
+
super.setUp();
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mSession = new RemoteMediaSessionCompat(DEFAULT_TEST_NAME, mContext);
@@ -106,7 +110,9 @@
@Override
public void cleanUp() throws Exception {
super.cleanUp();
- mSession.cleanUp();
+ if (mSession != null) {
+ mSession.cleanUp();
+ }
if (mController != null) {
mController.close();
}
diff --git a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerTest.java b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerTest.java
index e10e811d..1dab107 100644
--- a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerTest.java
+++ b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaControllerTest.java
@@ -30,6 +30,7 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
import android.app.PendingIntent;
import android.content.Context;
@@ -95,6 +96,9 @@
@Before
@Override
public void setUp() throws Exception {
+ // b/230354064
+ assumeTrue(Build.VERSION.SDK_INT != 17);
+
super.setUp();
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mRemoteSession = createRemoteMediaSession(DEFAULT_TEST_NAME, null);
diff --git a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaController_SurfaceTest.java b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaController_SurfaceTest.java
index 15df8f5..9d6c9fb 100644
--- a/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaController_SurfaceTest.java
+++ b/media2/media2-session/version-compat-tests/current/client/src/androidTest/java/androidx/media2/test/client/tests/MediaController_SurfaceTest.java
@@ -23,6 +23,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
import android.app.Instrumentation;
import android.app.KeyguardManager;
@@ -68,6 +69,9 @@
@Before
@Override
public void setUp() throws Exception {
+ // b/230354064
+ assumeTrue(Build.VERSION.SDK_INT != 17);
+
super.setUp();
mInstrumentation = InstrumentationRegistry.getInstrumentation();
@@ -82,8 +86,9 @@
@Override
public void cleanUp() throws Exception {
super.cleanUp();
-
- mRemoteSession.cleanUp();
+ if (mRemoteSession != null) {
+ mRemoteSession.cleanUp();
+ }
}
@Test
diff --git a/playground-common/playground-plugin/build.gradle b/playground-common/playground-plugin/build.gradle
index fe0ea87..b65ae88 100644
--- a/playground-common/playground-plugin/build.gradle
+++ b/playground-common/playground-plugin/build.gradle
@@ -20,8 +20,8 @@
}
dependencies {
- implementation("com.gradle:gradle-enterprise-gradle-plugin:3.10.1")
- implementation("com.gradle:common-custom-user-data-gradle-plugin:1.6.5")
+ implementation("com.gradle:gradle-enterprise-gradle-plugin:3.10.2")
+ implementation("com.gradle:common-custom-user-data-gradle-plugin:1.7.2")
testImplementation(libs.junit)
testImplementation(libs.truth)
}
diff --git a/playground-common/playground.properties b/playground-common/playground.properties
index a15765d..f6f7ca1 100644
--- a/playground-common/playground.properties
+++ b/playground-common/playground.properties
@@ -25,7 +25,7 @@
kotlin.code.style=official
# Disable docs
androidx.enableDocumentation=false
-androidx.playground.snapshotBuildId=8736715
+androidx.playground.snapshotBuildId=8757744
androidx.playground.metalavaBuildId=8670428
androidx.playground.dokkaBuildId=7472101
androidx.studio.type=playground
diff --git a/preference/preference/api/current.txt b/preference/preference/api/current.txt
index e79e26b8..19e1320 100644
--- a/preference/preference/api/current.txt
+++ b/preference/preference/api/current.txt
@@ -108,7 +108,7 @@
public class ListPreferenceDialogFragmentCompat extends androidx.preference.PreferenceDialogFragmentCompat {
ctor public ListPreferenceDialogFragmentCompat();
- method public static androidx.preference.ListPreferenceDialogFragmentCompat newInstance(String!);
+ method public static androidx.preference.ListPreferenceDialogFragmentCompat newInstance(String);
method public void onDialogClosed(boolean);
}
@@ -138,7 +138,7 @@
public class MultiSelectListPreferenceDialogFragmentCompat extends androidx.preference.PreferenceDialogFragmentCompat {
ctor public MultiSelectListPreferenceDialogFragmentCompat();
- method public static androidx.preference.MultiSelectListPreferenceDialogFragmentCompat newInstance(String!);
+ method public static androidx.preference.MultiSelectListPreferenceDialogFragmentCompat newInstance(String);
method public void onDialogClosed(boolean);
}
diff --git a/preference/preference/api/public_plus_experimental_current.txt b/preference/preference/api/public_plus_experimental_current.txt
index e79e26b8..19e1320 100644
--- a/preference/preference/api/public_plus_experimental_current.txt
+++ b/preference/preference/api/public_plus_experimental_current.txt
@@ -108,7 +108,7 @@
public class ListPreferenceDialogFragmentCompat extends androidx.preference.PreferenceDialogFragmentCompat {
ctor public ListPreferenceDialogFragmentCompat();
- method public static androidx.preference.ListPreferenceDialogFragmentCompat newInstance(String!);
+ method public static androidx.preference.ListPreferenceDialogFragmentCompat newInstance(String);
method public void onDialogClosed(boolean);
}
@@ -138,7 +138,7 @@
public class MultiSelectListPreferenceDialogFragmentCompat extends androidx.preference.PreferenceDialogFragmentCompat {
ctor public MultiSelectListPreferenceDialogFragmentCompat();
- method public static androidx.preference.MultiSelectListPreferenceDialogFragmentCompat newInstance(String!);
+ method public static androidx.preference.MultiSelectListPreferenceDialogFragmentCompat newInstance(String);
method public void onDialogClosed(boolean);
}
diff --git a/preference/preference/api/restricted_current.txt b/preference/preference/api/restricted_current.txt
index 5afeceb..1611229 100644
--- a/preference/preference/api/restricted_current.txt
+++ b/preference/preference/api/restricted_current.txt
@@ -108,7 +108,7 @@
public class ListPreferenceDialogFragmentCompat extends androidx.preference.PreferenceDialogFragmentCompat {
ctor public ListPreferenceDialogFragmentCompat();
- method public static androidx.preference.ListPreferenceDialogFragmentCompat newInstance(String!);
+ method public static androidx.preference.ListPreferenceDialogFragmentCompat newInstance(String);
method public void onDialogClosed(boolean);
}
@@ -138,7 +138,7 @@
public class MultiSelectListPreferenceDialogFragmentCompat extends androidx.preference.PreferenceDialogFragmentCompat {
ctor public MultiSelectListPreferenceDialogFragmentCompat();
- method public static androidx.preference.MultiSelectListPreferenceDialogFragmentCompat newInstance(String!);
+ method public static androidx.preference.MultiSelectListPreferenceDialogFragmentCompat newInstance(String);
method public void onDialogClosed(boolean);
}
diff --git a/preference/preference/src/main/java/androidx/preference/ListPreferenceDialogFragmentCompat.java b/preference/preference/src/main/java/androidx/preference/ListPreferenceDialogFragmentCompat.java
index 686844a..4e03c25 100644
--- a/preference/preference/src/main/java/androidx/preference/ListPreferenceDialogFragmentCompat.java
+++ b/preference/preference/src/main/java/androidx/preference/ListPreferenceDialogFragmentCompat.java
@@ -36,7 +36,7 @@
private CharSequence[] mEntryValues;
@NonNull
- public static ListPreferenceDialogFragmentCompat newInstance(String key) {
+ public static ListPreferenceDialogFragmentCompat newInstance(@NonNull String key) {
final ListPreferenceDialogFragmentCompat fragment =
new ListPreferenceDialogFragmentCompat();
final Bundle b = new Bundle(1);
diff --git a/preference/preference/src/main/java/androidx/preference/MultiSelectListPreferenceDialogFragmentCompat.java b/preference/preference/src/main/java/androidx/preference/MultiSelectListPreferenceDialogFragmentCompat.java
index b660a46..cb7d200 100644
--- a/preference/preference/src/main/java/androidx/preference/MultiSelectListPreferenceDialogFragmentCompat.java
+++ b/preference/preference/src/main/java/androidx/preference/MultiSelectListPreferenceDialogFragmentCompat.java
@@ -48,7 +48,7 @@
CharSequence[] mEntryValues;
@NonNull
- public static MultiSelectListPreferenceDialogFragmentCompat newInstance(String key) {
+ public static MultiSelectListPreferenceDialogFragmentCompat newInstance(@NonNull String key) {
final MultiSelectListPreferenceDialogFragmentCompat fragment =
new MultiSelectListPreferenceDialogFragmentCompat();
final Bundle b = new Bundle(1);
diff --git a/preference/preference/src/main/java/androidx/preference/PreferenceCategory.java b/preference/preference/src/main/java/androidx/preference/PreferenceCategory.java
index 65a2da5..a1c033d 100644
--- a/preference/preference/src/main/java/androidx/preference/PreferenceCategory.java
+++ b/preference/preference/src/main/java/androidx/preference/PreferenceCategory.java
@@ -21,10 +21,13 @@
import android.os.Build.VERSION_CODES;
import android.util.AttributeSet;
import android.util.TypedValue;
+import android.view.View;
import android.widget.TextView;
+import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.TypedArrayUtils;
@@ -74,7 +77,7 @@
public void onBindViewHolder(@NonNull PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
if (Build.VERSION.SDK_INT >= VERSION_CODES.P) {
- holder.itemView.setAccessibilityHeading(true);
+ Api28Impl.setAccessibilityHeading(holder.itemView, true);
} else if (Build.VERSION.SDK_INT < VERSION_CODES.LOLLIPOP) {
// We can't safely look for colorAccent in the category layout XML below Lollipop, as it
// only exists within AppCompat, and will crash if using a platform theme. We should
@@ -102,4 +105,12 @@
titleView.setTextColor(value.data);
}
}
+
+ @RequiresApi(28)
+ private static class Api28Impl {
+ @DoNotInline
+ static void setAccessibilityHeading(@NonNull View view, boolean isHeading) {
+ view.setAccessibilityHeading(isHeading);
+ }
+ }
}
diff --git a/preference/preference/src/main/java/androidx/preference/PreferenceScreen.java b/preference/preference/src/main/java/androidx/preference/PreferenceScreen.java
index 44b3ea6..1085608 100644
--- a/preference/preference/src/main/java/androidx/preference/PreferenceScreen.java
+++ b/preference/preference/src/main/java/androidx/preference/PreferenceScreen.java
@@ -18,6 +18,7 @@
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
@@ -79,6 +80,7 @@
* @return {@code true} if the adapter should use the preference IDs generated by
* {@link PreferenceGroup#addPreference(Preference)} as stable item IDs.
*/
+ @SuppressLint("KotlinPropertyAccess")
public boolean shouldUseGeneratedIds() {
return mShouldUseGeneratedIds;
}
diff --git a/preference/preference/src/main/java/androidx/preference/SeekBarPreference.java b/preference/preference/src/main/java/androidx/preference/SeekBarPreference.java
index d3cb27b..ff551b8 100644
--- a/preference/preference/src/main/java/androidx/preference/SeekBarPreference.java
+++ b/preference/preference/src/main/java/androidx/preference/SeekBarPreference.java
@@ -200,7 +200,7 @@
}
@Override
- protected void onSetInitialValue(Object defaultValue) {
+ protected void onSetInitialValue(@Nullable Object defaultValue) {
if (defaultValue == null) {
defaultValue = 0;
}
diff --git a/preference/preference/src/main/java/androidx/preference/TwoStatePreference.java b/preference/preference/src/main/java/androidx/preference/TwoStatePreference.java
index 50189ad8..daf3dbc 100644
--- a/preference/preference/src/main/java/androidx/preference/TwoStatePreference.java
+++ b/preference/preference/src/main/java/androidx/preference/TwoStatePreference.java
@@ -200,7 +200,7 @@
}
@Override
- protected void onSetInitialValue(Object defaultValue) {
+ protected void onSetInitialValue(@Nullable Object defaultValue) {
if (defaultValue == null) {
defaultValue = false;
}
@@ -222,7 +222,7 @@
* @hide
*/
@RestrictTo(LIBRARY)
- protected void syncSummaryView(View view) {
+ protected void syncSummaryView(@NonNull View view) {
if (!(view instanceof TextView)) {
return;
}
diff --git a/print/print/build.gradle b/print/print/build.gradle
index 548c919..733e8fb 100644
--- a/print/print/build.gradle
+++ b/print/print/build.gradle
@@ -6,7 +6,7 @@
}
dependencies {
- api("androidx.annotation:annotation:1.1.0")
+ api("androidx.annotation:annotation:1.2.0")
}
androidx {
diff --git a/print/print/src/main/java/androidx/print/PrintHelper.java b/print/print/src/main/java/androidx/print/PrintHelper.java
index ccbbad9..01f01f7 100644
--- a/print/print/src/main/java/androidx/print/PrintHelper.java
+++ b/print/print/src/main/java/androidx/print/PrintHelper.java
@@ -26,6 +26,7 @@
import android.graphics.ColorSpace;
import android.graphics.Matrix;
import android.graphics.Paint;
+import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.pdf.PdfDocument;
import android.net.Uri;
@@ -41,6 +42,7 @@
import android.print.pdf.PrintedPdfDocument;
import android.util.Log;
+import androidx.annotation.DoNotInline;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -50,6 +52,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -262,19 +265,19 @@
PrintManager printManager =
(PrintManager) mContext.getSystemService(Context.PRINT_SERVICE);
- PrintAttributes.MediaSize mediaSize;
- if (isPortrait(bitmap)) {
- mediaSize = PrintAttributes.MediaSize.UNKNOWN_PORTRAIT;
- } else {
- mediaSize = PrintAttributes.MediaSize.UNKNOWN_LANDSCAPE;
- }
- PrintAttributes attr = new PrintAttributes.Builder()
- .setMediaSize(mediaSize)
- .setColorMode(mColorMode)
- .build();
- printManager.print(jobName,
- new PrintBitmapAdapter(jobName, mScaleMode, bitmap, callback), attr);
+ PrintAttributes.Builder builder = Api19Impl.createPrintAttributesBuilder();
+ Api19Impl.setColorMode(builder, mColorMode);
+ if (isPortrait(bitmap)) {
+ Api19Impl.setMediaSize(builder, PrintAttributes.MediaSize.UNKNOWN_PORTRAIT);
+ } else {
+ Api19Impl.setMediaSize(builder, PrintAttributes.MediaSize.UNKNOWN_LANDSCAPE);
+ }
+
+ Api19Impl.print(printManager,
+ jobName,
+ new PrintBitmapAdapter(jobName, mScaleMode, bitmap, callback),
+ Api19Impl.buildPrintAttributes(builder));
}
@RequiresApi(19)
@@ -363,17 +366,18 @@
PrintManager printManager =
(PrintManager) mContext.getSystemService(Context.PRINT_SERVICE);
- PrintAttributes.Builder builder = new PrintAttributes.Builder();
- builder.setColorMode(mColorMode);
+
+ PrintAttributes.Builder builder = Api19Impl.createPrintAttributesBuilder();
+ Api19Impl.setColorMode(builder, mColorMode);
if (mOrientation == ORIENTATION_LANDSCAPE || mOrientation == 0) {
- builder.setMediaSize(PrintAttributes.MediaSize.UNKNOWN_LANDSCAPE);
+ Api19Impl.setMediaSize(builder, PrintAttributes.MediaSize.UNKNOWN_LANDSCAPE);
} else if (mOrientation == ORIENTATION_PORTRAIT) {
- builder.setMediaSize(PrintAttributes.MediaSize.UNKNOWN_PORTRAIT);
+ Api19Impl.setMediaSize(builder, PrintAttributes.MediaSize.UNKNOWN_PORTRAIT);
}
- PrintAttributes attr = builder.build();
- printManager.print(jobName, printDocumentAdapter, attr);
+ Api19Impl.print(printManager, jobName, printDocumentAdapter,
+ Api19Impl.buildPrintAttributes(builder));
}
@SuppressWarnings("deprecation")
@@ -557,18 +561,19 @@
*/
@RequiresApi(19)
private static PrintAttributes.Builder copyAttributes(PrintAttributes other) {
- PrintAttributes.Builder b = new PrintAttributes.Builder()
- .setMediaSize(other.getMediaSize())
- .setResolution(other.getResolution())
- .setMinMargins(other.getMinMargins());
+ PrintAttributes.Builder b = Api19Impl.createPrintAttributesBuilder();
+ Api19Impl.setMediaSize(b, Api19Impl.getMediaSize(other));
+ Api19Impl.setResolution(b, Api19Impl.getResolution(other));
+ Api19Impl.setMinMargins(b, Api19Impl.getMinMargins(other));
- if (other.getColorMode() != 0) {
- b.setColorMode(other.getColorMode());
+
+ if (Api19Impl.getColorMode(other) != 0) {
+ Api19Impl.setColorMode(b, Api19Impl.getColorMode(other));
}
if (Build.VERSION.SDK_INT >= 23) {
- if (other.getDuplexMode() != 0) {
- b.setDuplexMode(other.getDuplexMode());
+ if (Api23Impl.getDuplexMode(other) != 0) {
+ Api23Impl.setDuplexMode(b, Api23Impl.getDuplexMode(other));
}
}
@@ -630,43 +635,47 @@
} else {
// If the handling of any margin != 0 is broken, strip the margins and add them to
// the bitmap later
- pdfAttributes = copyAttributes(attributes)
- .setMinMargins(new PrintAttributes.Margins(0, 0, 0, 0)).build();
+ PrintAttributes.Builder builder = copyAttributes(attributes);
+ Api19Impl.setMinMargins(builder, Api19Impl.createMargins(0, 0, 0, 0));
+ pdfAttributes = Api19Impl.buildPrintAttributes(builder);
}
new android.os.AsyncTask<Void, Void, Throwable>() {
@Override
protected Throwable doInBackground(Void... params) {
try {
- if (cancellationSignal.isCanceled()) {
+ if (Api16Impl.isCanceled(cancellationSignal)) {
return null;
}
- PrintedPdfDocument pdfDocument = new PrintedPdfDocument(mContext,
- pdfAttributes);
+ PrintedPdfDocument pdfDocument =
+ Api19Impl.createPrintedPdfDocument(mContext, pdfAttributes);
Bitmap maybeGrayscale = convertBitmapForColorMode(bitmap,
- pdfAttributes.getColorMode());
+ Api19Impl.getColorMode(pdfAttributes));
- if (cancellationSignal.isCanceled()) {
+ if (Api16Impl.isCanceled(cancellationSignal)) {
return null;
}
try {
- PdfDocument.Page page = pdfDocument.startPage(1);
+ PdfDocument.Page page = Api19Impl.startPage(pdfDocument, 1);
RectF contentRect;
if (IS_MIN_MARGINS_HANDLING_CORRECT) {
- contentRect = new RectF(page.getInfo().getContentRect());
+ contentRect = new RectF(Api19Impl.getContentRect(
+ Api19Impl.getInfo(page)));
} else {
// Create dummy doc that has the margins to compute correctly sized
// content rectangle
- PrintedPdfDocument dummyDocument = new PrintedPdfDocument(mContext,
- attributes);
- PdfDocument.Page dummyPage = dummyDocument.startPage(1);
- contentRect = new RectF(dummyPage.getInfo().getContentRect());
- dummyDocument.finishPage(dummyPage);
- dummyDocument.close();
+ PrintedPdfDocument dummyDocument = Api19Impl.createPrintedPdfDocument(
+ mContext, attributes);
+ PdfDocument.Page dummyPage = Api19Impl.startPage(dummyDocument, 1);
+ contentRect =
+ new RectF(
+ Api19Impl.getContentRect(Api19Impl.getInfo(dummyPage)));
+ Api19Impl.finishPage(dummyDocument, dummyPage);
+ Api19Impl.close(dummyDocument);
}
// Resize bitmap
@@ -681,25 +690,25 @@
matrix.postTranslate(contentRect.left, contentRect.top);
// Cut off margins
- page.getCanvas().clipRect(contentRect);
+ Api19Impl.getCanvas(page).clipRect(contentRect);
}
// Draw the bitmap.
- page.getCanvas().drawBitmap(maybeGrayscale, matrix, null);
+ Api19Impl.getCanvas(page).drawBitmap(maybeGrayscale, matrix, null);
// Finish the page.
- pdfDocument.finishPage(page);
+ Api19Impl.finishPage(pdfDocument, page);
- if (cancellationSignal.isCanceled()) {
+ if (Api16Impl.isCanceled(cancellationSignal)) {
return null;
}
// Write the document.
- pdfDocument.writeTo(
- new FileOutputStream(fileDescriptor.getFileDescriptor()));
+ Api19Impl.writeTo(pdfDocument, new FileOutputStream(
+ fileDescriptor.getFileDescriptor()));
return null;
} finally {
- pdfDocument.close();
+ Api19Impl.close(pdfDocument);
if (fileDescriptor != null) {
try {
@@ -720,17 +729,17 @@
@Override
protected void onPostExecute(Throwable throwable) {
- if (cancellationSignal.isCanceled()) {
+ if (Api16Impl.isCanceled(cancellationSignal)) {
// Cancelled.
- writeResultCallback.onWriteCancelled();
+ Api19Impl.onWriteCancelled(writeResultCallback);
} else if (throwable == null) {
// Done.
- writeResultCallback.onWriteFinished(
- new PageRange[] { PageRange.ALL_PAGES });
+ Api19Impl.onWriteFinished(
+ writeResultCallback, new PageRange[]{PageRange.ALL_PAGES});
} else {
// Failed.
Log.e(LOG_TAG, "Error writing printed content", throwable);
- writeResultCallback.onWriteFailed(null);
+ Api19Impl.onWriteFailed(writeResultCallback, null);
}
}
}.execute();
@@ -780,7 +789,7 @@
mDecodeOptions.inMutable = true;
mDecodeOptions.inSampleSize = sampleSize;
if (Build.VERSION.SDK_INT >= 26) {
- mDecodeOptions.inPreferredColorSpace = ColorSpace.get(ColorSpace.Named.SRGB);
+ mDecodeOptions.inPreferredColorSpace = Api26Impl.get(ColorSpace.Named.SRGB);
}
decodeOptions = mDecodeOptions;
}
@@ -835,4 +844,182 @@
return grayscale;
}
+
+ @RequiresApi(16)
+ static class Api16Impl {
+ private Api16Impl() {
+ // This class is not instantiable.
+ }
+
+ @DoNotInline
+ static boolean isCanceled(CancellationSignal cancellationSignal) {
+ return cancellationSignal.isCanceled();
+ }
+
+ }
+
+ @RequiresApi(19)
+ private static class Api19Impl {
+ private Api19Impl() {
+ // This class is not instantiable.
+ }
+
+ @DoNotInline
+ static PrintAttributes.Builder createPrintAttributesBuilder() {
+ return new PrintAttributes.Builder();
+ }
+
+ @DoNotInline
+ static void setColorMode(PrintAttributes.Builder builder,
+ int colorMode) {
+ builder.setColorMode(colorMode);
+ }
+
+ @DoNotInline
+ static void setMediaSize(PrintAttributes.Builder builder,
+ PrintAttributes.MediaSize mediaSize) {
+ builder.setMediaSize(mediaSize);
+ }
+
+ @DoNotInline
+ static void setMinMargins(PrintAttributes.Builder builder,
+ PrintAttributes.Margins minMargins) {
+ builder.setMinMargins(minMargins);
+ }
+
+ @DoNotInline
+ static void setResolution(PrintAttributes.Builder builder,
+ PrintAttributes.Resolution resolution) {
+ builder.setResolution(resolution);
+ }
+
+ @DoNotInline
+ public static PrintAttributes buildPrintAttributes(PrintAttributes.Builder builder) {
+ return builder.build();
+ }
+
+ @DoNotInline
+ static void print(PrintManager
+ printManager, String jobName, PrintDocumentAdapter printAdapter,
+ PrintAttributes attr) {
+
+
+ printManager.print(jobName, printAdapter, attr);
+ }
+
+ @DoNotInline
+ static PrintAttributes.MediaSize getMediaSize(PrintAttributes printAttributes) {
+ return printAttributes.getMediaSize();
+ }
+
+ @DoNotInline
+ static PrintAttributes.Resolution getResolution(PrintAttributes printAttributes) {
+ return printAttributes.getResolution();
+ }
+
+ @DoNotInline
+ static PrintAttributes.Margins getMinMargins(PrintAttributes printAttributes) {
+ return printAttributes.getMinMargins();
+ }
+
+ @DoNotInline
+ static int getColorMode(PrintAttributes printAttributes) {
+ return printAttributes.getColorMode();
+ }
+
+ @DoNotInline
+ static PrintAttributes.Margins createMargins(int leftMils, int topMils, int rightMils,
+ int bottomMils) {
+ return new PrintAttributes.Margins(leftMils, topMils, rightMils, bottomMils);
+ }
+
+ @DoNotInline
+ static PrintedPdfDocument createPrintedPdfDocument(Context context,
+ PrintAttributes attributes) {
+ return new PrintedPdfDocument(context, attributes);
+ }
+
+ @DoNotInline
+ static PdfDocument.Page startPage(PrintedPdfDocument printedPdfDocument, int pageNumber) {
+ return printedPdfDocument.startPage(pageNumber);
+ }
+
+ @DoNotInline
+ static PdfDocument.PageInfo getInfo(PdfDocument.Page page) {
+ return page.getInfo();
+ }
+
+ @DoNotInline
+ static Rect getContentRect(PdfDocument.PageInfo pageInfo) {
+ return pageInfo.getContentRect();
+ }
+
+ @DoNotInline
+ static void finishPage(PdfDocument pdfDocument, PdfDocument.Page page) {
+ pdfDocument.finishPage(page);
+ }
+
+ @DoNotInline
+ static void close(PdfDocument pdfDocument) {
+ pdfDocument.close();
+ }
+
+ @DoNotInline
+ static Canvas getCanvas(PdfDocument.Page page) {
+ return page.getCanvas();
+ }
+
+ @DoNotInline
+ static void writeTo(PdfDocument pdfDocument, OutputStream out) throws IOException {
+ pdfDocument.writeTo(out);
+ }
+
+ @DoNotInline
+ static void onWriteCancelled(PrintDocumentAdapter.WriteResultCallback writeResultCallback) {
+ writeResultCallback.onWriteCancelled();
+ }
+
+ @DoNotInline
+ static void onWriteFinished(PrintDocumentAdapter.WriteResultCallback writeResultCallback,
+ PageRange[] pages) {
+ writeResultCallback.onWriteFinished(pages);
+ }
+
+ @DoNotInline
+ static void onWriteFailed(PrintDocumentAdapter.WriteResultCallback writeResultCallback,
+ CharSequence error) {
+ writeResultCallback.onWriteFailed(error);
+ }
+ }
+
+ @RequiresApi(23)
+ static class Api23Impl {
+ private Api23Impl() {
+ // This class is not instantiable.
+ }
+
+ @DoNotInline
+ static int getDuplexMode(PrintAttributes printAttributes) {
+ return printAttributes.getDuplexMode();
+ }
+
+ @DoNotInline
+ static void setDuplexMode(PrintAttributes.Builder builder, int duplexMode) {
+ builder.setDuplexMode(duplexMode);
+ }
+ }
+
+ @RequiresApi(26)
+ static class Api26Impl {
+ private Api26Impl() {
+ // This class is not instantiable.
+ }
+
+ @DoNotInline
+ static ColorSpace get(ColorSpace.Named name) {
+ return ColorSpace.get(name);
+ }
+
+ }
}
+
diff --git a/recyclerview/recyclerview/api/current.txt b/recyclerview/recyclerview/api/current.txt
index 29e8244..5cd3f0e 100644
--- a/recyclerview/recyclerview/api/current.txt
+++ b/recyclerview/recyclerview/api/current.txt
@@ -150,7 +150,7 @@
}
public class DividerItemDecoration extends androidx.recyclerview.widget.RecyclerView.ItemDecoration {
- ctor public DividerItemDecoration(android.content.Context!, int);
+ ctor public DividerItemDecoration(android.content.Context, int);
method public android.graphics.drawable.Drawable? getDrawable();
method public void setDrawable(android.graphics.drawable.Drawable);
method public void setOrientation(int);
@@ -312,20 +312,20 @@
}
public class LinearSmoothScroller extends androidx.recyclerview.widget.RecyclerView.SmoothScroller {
- ctor public LinearSmoothScroller(android.content.Context!);
+ ctor public LinearSmoothScroller(android.content.Context);
method public int calculateDtToFit(int, int, int, int, int);
- method public int calculateDxToMakeVisible(android.view.View!, int);
- method public int calculateDyToMakeVisible(android.view.View!, int);
- method protected float calculateSpeedPerPixel(android.util.DisplayMetrics!);
+ method public int calculateDxToMakeVisible(android.view.View, int);
+ method public int calculateDyToMakeVisible(android.view.View, int);
+ method protected float calculateSpeedPerPixel(android.util.DisplayMetrics);
method protected int calculateTimeForDeceleration(int);
method protected int calculateTimeForScrolling(int);
method protected int getHorizontalSnapPreference();
method protected int getVerticalSnapPreference();
- method protected void onSeekTargetStep(int, int, androidx.recyclerview.widget.RecyclerView.State!, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action!);
+ method protected void onSeekTargetStep(int, int, androidx.recyclerview.widget.RecyclerView.State, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action);
method protected void onStart();
method protected void onStop();
- method protected void onTargetFound(android.view.View!, androidx.recyclerview.widget.RecyclerView.State!, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action!);
- method protected void updateActionForInterimTarget(androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action!);
+ method protected void onTargetFound(android.view.View, androidx.recyclerview.widget.RecyclerView.State, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action);
+ method protected void updateActionForInterimTarget(androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action);
field public static final int SNAP_TO_ANY = 0; // 0x0
field public static final int SNAP_TO_END = 1; // 0x1
field public static final int SNAP_TO_START = -1; // 0xffffffff
@@ -333,7 +333,7 @@
field protected int mInterimTargetDx;
field protected int mInterimTargetDy;
field protected final android.view.animation.LinearInterpolator! mLinearInterpolator;
- field protected android.graphics.PointF! mTargetVector;
+ field protected android.graphics.PointF? mTargetVector;
}
public class LinearSnapHelper extends androidx.recyclerview.widget.SnapHelper {
@@ -391,8 +391,8 @@
public class PagerSnapHelper extends androidx.recyclerview.widget.SnapHelper {
ctor public PagerSnapHelper();
method public int[]? calculateDistanceToFinalSnap(androidx.recyclerview.widget.RecyclerView.LayoutManager, android.view.View);
- method public android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager!);
- method public int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager!, int, int);
+ method public android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager);
+ method public int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager, int, int);
}
public class RecyclerView extends android.view.ViewGroup implements androidx.core.view.NestedScrollingChild2 androidx.core.view.NestedScrollingChild3 androidx.core.view.ScrollingView {
@@ -989,11 +989,11 @@
ctor public SnapHelper();
method public void attachToRecyclerView(androidx.recyclerview.widget.RecyclerView?) throws java.lang.IllegalStateException;
method public abstract int[]? calculateDistanceToFinalSnap(androidx.recyclerview.widget.RecyclerView.LayoutManager, android.view.View);
- method public int[]! calculateScrollDistance(int, int);
+ method public int[] calculateScrollDistance(int, int);
method protected androidx.recyclerview.widget.RecyclerView.SmoothScroller? createScroller(androidx.recyclerview.widget.RecyclerView.LayoutManager);
method @Deprecated protected androidx.recyclerview.widget.LinearSmoothScroller? createSnapScroller(androidx.recyclerview.widget.RecyclerView.LayoutManager);
- method public abstract android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager!);
- method public abstract int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager!, int, int);
+ method public abstract android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager);
+ method public abstract int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager, int, int);
method public boolean onFling(int, int);
}
@@ -1021,7 +1021,7 @@
}
public static class SortedList.BatchedCallback<T2> extends androidx.recyclerview.widget.SortedList.Callback<T2> {
- ctor public SortedList.BatchedCallback(androidx.recyclerview.widget.SortedList.Callback<T2!>!);
+ ctor public SortedList.BatchedCallback(androidx.recyclerview.widget.SortedList.Callback<T2!>);
method public boolean areContentsTheSame(T2!, T2!);
method public boolean areItemsTheSame(T2!, T2!);
method public int compare(T2!, T2!);
@@ -1039,7 +1039,7 @@
method public abstract int compare(T2!, T2!);
method public Object? getChangePayload(T2!, T2!);
method public abstract void onChanged(int, int);
- method public void onChanged(int, int, Object!);
+ method public void onChanged(int, int, Object?);
}
public abstract class SortedListAdapterCallback<T2> extends androidx.recyclerview.widget.SortedList.Callback<T2> {
diff --git a/recyclerview/recyclerview/api/public_plus_experimental_current.txt b/recyclerview/recyclerview/api/public_plus_experimental_current.txt
index 29e8244..5cd3f0e 100644
--- a/recyclerview/recyclerview/api/public_plus_experimental_current.txt
+++ b/recyclerview/recyclerview/api/public_plus_experimental_current.txt
@@ -150,7 +150,7 @@
}
public class DividerItemDecoration extends androidx.recyclerview.widget.RecyclerView.ItemDecoration {
- ctor public DividerItemDecoration(android.content.Context!, int);
+ ctor public DividerItemDecoration(android.content.Context, int);
method public android.graphics.drawable.Drawable? getDrawable();
method public void setDrawable(android.graphics.drawable.Drawable);
method public void setOrientation(int);
@@ -312,20 +312,20 @@
}
public class LinearSmoothScroller extends androidx.recyclerview.widget.RecyclerView.SmoothScroller {
- ctor public LinearSmoothScroller(android.content.Context!);
+ ctor public LinearSmoothScroller(android.content.Context);
method public int calculateDtToFit(int, int, int, int, int);
- method public int calculateDxToMakeVisible(android.view.View!, int);
- method public int calculateDyToMakeVisible(android.view.View!, int);
- method protected float calculateSpeedPerPixel(android.util.DisplayMetrics!);
+ method public int calculateDxToMakeVisible(android.view.View, int);
+ method public int calculateDyToMakeVisible(android.view.View, int);
+ method protected float calculateSpeedPerPixel(android.util.DisplayMetrics);
method protected int calculateTimeForDeceleration(int);
method protected int calculateTimeForScrolling(int);
method protected int getHorizontalSnapPreference();
method protected int getVerticalSnapPreference();
- method protected void onSeekTargetStep(int, int, androidx.recyclerview.widget.RecyclerView.State!, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action!);
+ method protected void onSeekTargetStep(int, int, androidx.recyclerview.widget.RecyclerView.State, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action);
method protected void onStart();
method protected void onStop();
- method protected void onTargetFound(android.view.View!, androidx.recyclerview.widget.RecyclerView.State!, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action!);
- method protected void updateActionForInterimTarget(androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action!);
+ method protected void onTargetFound(android.view.View, androidx.recyclerview.widget.RecyclerView.State, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action);
+ method protected void updateActionForInterimTarget(androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action);
field public static final int SNAP_TO_ANY = 0; // 0x0
field public static final int SNAP_TO_END = 1; // 0x1
field public static final int SNAP_TO_START = -1; // 0xffffffff
@@ -333,7 +333,7 @@
field protected int mInterimTargetDx;
field protected int mInterimTargetDy;
field protected final android.view.animation.LinearInterpolator! mLinearInterpolator;
- field protected android.graphics.PointF! mTargetVector;
+ field protected android.graphics.PointF? mTargetVector;
}
public class LinearSnapHelper extends androidx.recyclerview.widget.SnapHelper {
@@ -391,8 +391,8 @@
public class PagerSnapHelper extends androidx.recyclerview.widget.SnapHelper {
ctor public PagerSnapHelper();
method public int[]? calculateDistanceToFinalSnap(androidx.recyclerview.widget.RecyclerView.LayoutManager, android.view.View);
- method public android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager!);
- method public int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager!, int, int);
+ method public android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager);
+ method public int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager, int, int);
}
public class RecyclerView extends android.view.ViewGroup implements androidx.core.view.NestedScrollingChild2 androidx.core.view.NestedScrollingChild3 androidx.core.view.ScrollingView {
@@ -989,11 +989,11 @@
ctor public SnapHelper();
method public void attachToRecyclerView(androidx.recyclerview.widget.RecyclerView?) throws java.lang.IllegalStateException;
method public abstract int[]? calculateDistanceToFinalSnap(androidx.recyclerview.widget.RecyclerView.LayoutManager, android.view.View);
- method public int[]! calculateScrollDistance(int, int);
+ method public int[] calculateScrollDistance(int, int);
method protected androidx.recyclerview.widget.RecyclerView.SmoothScroller? createScroller(androidx.recyclerview.widget.RecyclerView.LayoutManager);
method @Deprecated protected androidx.recyclerview.widget.LinearSmoothScroller? createSnapScroller(androidx.recyclerview.widget.RecyclerView.LayoutManager);
- method public abstract android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager!);
- method public abstract int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager!, int, int);
+ method public abstract android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager);
+ method public abstract int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager, int, int);
method public boolean onFling(int, int);
}
@@ -1021,7 +1021,7 @@
}
public static class SortedList.BatchedCallback<T2> extends androidx.recyclerview.widget.SortedList.Callback<T2> {
- ctor public SortedList.BatchedCallback(androidx.recyclerview.widget.SortedList.Callback<T2!>!);
+ ctor public SortedList.BatchedCallback(androidx.recyclerview.widget.SortedList.Callback<T2!>);
method public boolean areContentsTheSame(T2!, T2!);
method public boolean areItemsTheSame(T2!, T2!);
method public int compare(T2!, T2!);
@@ -1039,7 +1039,7 @@
method public abstract int compare(T2!, T2!);
method public Object? getChangePayload(T2!, T2!);
method public abstract void onChanged(int, int);
- method public void onChanged(int, int, Object!);
+ method public void onChanged(int, int, Object?);
}
public abstract class SortedListAdapterCallback<T2> extends androidx.recyclerview.widget.SortedList.Callback<T2> {
diff --git a/recyclerview/recyclerview/api/restricted_current.txt b/recyclerview/recyclerview/api/restricted_current.txt
index 103a0e1..1c5af03 100644
--- a/recyclerview/recyclerview/api/restricted_current.txt
+++ b/recyclerview/recyclerview/api/restricted_current.txt
@@ -150,7 +150,7 @@
}
public class DividerItemDecoration extends androidx.recyclerview.widget.RecyclerView.ItemDecoration {
- ctor public DividerItemDecoration(android.content.Context!, int);
+ ctor public DividerItemDecoration(android.content.Context, int);
method public android.graphics.drawable.Drawable? getDrawable();
method public void setDrawable(android.graphics.drawable.Drawable);
method public void setOrientation(int);
@@ -312,20 +312,20 @@
}
public class LinearSmoothScroller extends androidx.recyclerview.widget.RecyclerView.SmoothScroller {
- ctor public LinearSmoothScroller(android.content.Context!);
+ ctor public LinearSmoothScroller(android.content.Context);
method public int calculateDtToFit(int, int, int, int, int);
- method public int calculateDxToMakeVisible(android.view.View!, int);
- method public int calculateDyToMakeVisible(android.view.View!, int);
- method protected float calculateSpeedPerPixel(android.util.DisplayMetrics!);
+ method public int calculateDxToMakeVisible(android.view.View, int);
+ method public int calculateDyToMakeVisible(android.view.View, int);
+ method protected float calculateSpeedPerPixel(android.util.DisplayMetrics);
method protected int calculateTimeForDeceleration(int);
method protected int calculateTimeForScrolling(int);
method protected int getHorizontalSnapPreference();
method protected int getVerticalSnapPreference();
- method protected void onSeekTargetStep(int, int, androidx.recyclerview.widget.RecyclerView.State!, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action!);
+ method protected void onSeekTargetStep(int, int, androidx.recyclerview.widget.RecyclerView.State, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action);
method protected void onStart();
method protected void onStop();
- method protected void onTargetFound(android.view.View!, androidx.recyclerview.widget.RecyclerView.State!, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action!);
- method protected void updateActionForInterimTarget(androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action!);
+ method protected void onTargetFound(android.view.View, androidx.recyclerview.widget.RecyclerView.State, androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action);
+ method protected void updateActionForInterimTarget(androidx.recyclerview.widget.RecyclerView.SmoothScroller.Action);
field public static final int SNAP_TO_ANY = 0; // 0x0
field public static final int SNAP_TO_END = 1; // 0x1
field public static final int SNAP_TO_START = -1; // 0xffffffff
@@ -333,7 +333,7 @@
field protected int mInterimTargetDx;
field protected int mInterimTargetDy;
field protected final android.view.animation.LinearInterpolator! mLinearInterpolator;
- field protected android.graphics.PointF! mTargetVector;
+ field protected android.graphics.PointF? mTargetVector;
}
public class LinearSnapHelper extends androidx.recyclerview.widget.SnapHelper {
@@ -391,8 +391,8 @@
public class PagerSnapHelper extends androidx.recyclerview.widget.SnapHelper {
ctor public PagerSnapHelper();
method public int[]? calculateDistanceToFinalSnap(androidx.recyclerview.widget.RecyclerView.LayoutManager, android.view.View);
- method public android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager!);
- method public int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager!, int, int);
+ method public android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager);
+ method public int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager, int, int);
}
public class RecyclerView extends android.view.ViewGroup implements androidx.core.view.NestedScrollingChild2 androidx.core.view.NestedScrollingChild3 androidx.core.view.ScrollingView {
@@ -992,11 +992,11 @@
ctor public SnapHelper();
method public void attachToRecyclerView(androidx.recyclerview.widget.RecyclerView?) throws java.lang.IllegalStateException;
method public abstract int[]? calculateDistanceToFinalSnap(androidx.recyclerview.widget.RecyclerView.LayoutManager, android.view.View);
- method public int[]! calculateScrollDistance(int, int);
+ method public int[] calculateScrollDistance(int, int);
method protected androidx.recyclerview.widget.RecyclerView.SmoothScroller? createScroller(androidx.recyclerview.widget.RecyclerView.LayoutManager);
method @Deprecated protected androidx.recyclerview.widget.LinearSmoothScroller? createSnapScroller(androidx.recyclerview.widget.RecyclerView.LayoutManager);
- method public abstract android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager!);
- method public abstract int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager!, int, int);
+ method public abstract android.view.View? findSnapView(androidx.recyclerview.widget.RecyclerView.LayoutManager);
+ method public abstract int findTargetSnapPosition(androidx.recyclerview.widget.RecyclerView.LayoutManager, int, int);
method public boolean onFling(int, int);
}
@@ -1024,7 +1024,7 @@
}
public static class SortedList.BatchedCallback<T2> extends androidx.recyclerview.widget.SortedList.Callback<T2> {
- ctor public SortedList.BatchedCallback(androidx.recyclerview.widget.SortedList.Callback<T2!>!);
+ ctor public SortedList.BatchedCallback(androidx.recyclerview.widget.SortedList.Callback<T2!>);
method public boolean areContentsTheSame(T2!, T2!);
method public boolean areItemsTheSame(T2!, T2!);
method public int compare(T2!, T2!);
@@ -1042,7 +1042,7 @@
method public abstract int compare(T2!, T2!);
method public Object? getChangePayload(T2!, T2!);
method public abstract void onChanged(int, int);
- method public void onChanged(int, int, Object!);
+ method public void onChanged(int, int, Object?);
}
public abstract class SortedListAdapterCallback<T2> extends androidx.recyclerview.widget.SortedList.Callback<T2> {
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseRecyclerViewInstrumentationTest.java b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseRecyclerViewInstrumentationTest.java
index 9ae297a..d51e8c4 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseRecyclerViewInstrumentationTest.java
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseRecyclerViewInstrumentationTest.java
@@ -398,8 +398,8 @@
if (addPositionCheckItemAnimator) {
mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
RecyclerView.ViewHolder vh = parent.getChildViewHolder(view);
if (!vh.isRemoved()) {
assertNotSame("If getItemOffsets is called, child should have a valid"
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseStaggeredGridLayoutManagerTest.java b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseStaggeredGridLayoutManagerTest.java
index 9a9aa73..9fc19ea 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseStaggeredGridLayoutManagerTest.java
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseStaggeredGridLayoutManagerTest.java
@@ -113,8 +113,8 @@
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
try {
StaggeredGridLayoutManager.LayoutParams
lp = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerCustomSizeInScrollDirectionTest.java b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerCustomSizeInScrollDirectionTest.java
index 5066ef1..f075e25 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerCustomSizeInScrollDirectionTest.java
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerCustomSizeInScrollDirectionTest.java
@@ -101,8 +101,8 @@
if (mAddDecorOffsets) {
rv.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
if (mConfig.mOrientation == HORIZONTAL) {
outRect.set(decorOffset, 0, decorOffset, 0);
} else {
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerWrapContentTest.java b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerWrapContentTest.java
index e7bb9db..9ba996a 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerWrapContentTest.java
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerWrapContentTest.java
@@ -27,6 +27,7 @@
import android.view.Gravity;
import android.view.View;
+import androidx.annotation.NonNull;
import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
@@ -86,8 +87,8 @@
public void testVerticalWithItemDecors() throws Throwable {
mItemDecoration = new RecyclerView.ItemDecoration() {
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
outRect.set(0, 5, 0, 10);
}
};
@@ -107,8 +108,8 @@
public void testHorizontalWithItemDecors() throws Throwable {
mItemDecoration = new RecyclerView.ItemDecoration() {
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
outRect.set(5, 0, 10, 0);
}
};
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewAnimationsTest.java b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewAnimationsTest.java
index 5ed1d4b..b99bf94 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewAnimationsTest.java
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewAnimationsTest.java
@@ -575,8 +575,8 @@
public void run() {
mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
if (view == targetChild[0]) {
outRect.set(10, 20, 30, 40);
} else {
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewLayoutTest.java b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewLayoutTest.java
index 1f308a1..1c4d675 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewLayoutTest.java
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewLayoutTest.java
@@ -983,8 +983,8 @@
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
outRect.set(1, 2, 3, 4);
}
});
@@ -3844,8 +3844,8 @@
final RecyclerView.ItemDecoration decoration = new RecyclerView.ItemDecoration() {
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
try {
TestViewHolder tvh = (TestViewHolder) parent.getChildViewHolder(view);
Object data = tvh.getData();
@@ -5251,8 +5251,8 @@
if (addItemDecors) {
rv.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
outRect.set(0, 10, 0, 10);
}
});
diff --git a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/DividerItemDecoration.java b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/DividerItemDecoration.java
index ef9e9bae..f54070b 100644
--- a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/DividerItemDecoration.java
+++ b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/DividerItemDecoration.java
@@ -63,7 +63,7 @@
* @param context Current context, it will be used to access resources.
* @param orientation Divider orientation. Should be {@link #HORIZONTAL} or {@link #VERTICAL}.
*/
- public DividerItemDecoration(Context context, int orientation) {
+ public DividerItemDecoration(@NonNull Context context, int orientation) {
final TypedArray a = context.obtainStyledAttributes(ATTRS);
mDivider = a.getDrawable(0);
if (mDivider == null) {
@@ -109,7 +109,8 @@
}
@Override
- public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
+ public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent,
+ @NonNull RecyclerView.State state) {
if (parent.getLayoutManager() == null || mDivider == null) {
return;
}
@@ -175,8 +176,8 @@
}
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
if (mDivider == null) {
outRect.set(0, 0, 0, 0);
return;
diff --git a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java
index e08fdd1..07a80ff 100644
--- a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java
+++ b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java
@@ -552,7 +552,8 @@
}
@Override
- public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
+ public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent,
+ @NonNull RecyclerView.State state) {
// we don't know if RV changed something so we should invalidate this index.
mOverdrawChildPosition = -1;
float dx = 0, dy = 0;
@@ -930,8 +931,8 @@
}
@Override
- public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
- RecyclerView.State state) {
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
+ @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
outRect.setEmpty();
}
diff --git a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/LinearSmoothScroller.java b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/LinearSmoothScroller.java
index b32047f..335c9dd 100644
--- a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/LinearSmoothScroller.java
+++ b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/LinearSmoothScroller.java
@@ -23,6 +23,9 @@
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
/**
* {@link RecyclerView.SmoothScroller} implementation which uses a {@link LinearInterpolator} until
* the target position becomes a child of the RecyclerView and then uses a
@@ -80,6 +83,7 @@
protected final DecelerateInterpolator mDecelerateInterpolator = new DecelerateInterpolator();
+ @Nullable
protected PointF mTargetVector;
private final DisplayMetrics mDisplayMetrics;
@@ -90,7 +94,7 @@
// point to a real item position, rather point to an estimated location pixels.
protected int mInterimTargetDx = 0, mInterimTargetDy = 0;
- public LinearSmoothScroller(Context context) {
+ public LinearSmoothScroller(@NonNull Context context) {
mDisplayMetrics = context.getResources().getDisplayMetrics();
}
@@ -106,7 +110,8 @@
* {@inheritDoc}
*/
@Override
- protected void onTargetFound(View targetView, RecyclerView.State state, Action action) {
+ protected void onTargetFound(@NonNull View targetView,
+ @NonNull RecyclerView.State state, @NonNull Action action) {
final int dx = calculateDxToMakeVisible(targetView, getHorizontalSnapPreference());
final int dy = calculateDyToMakeVisible(targetView, getVerticalSnapPreference());
final int distance = (int) Math.sqrt(dx * dx + dy * dy);
@@ -120,7 +125,8 @@
* {@inheritDoc}
*/
@Override
- protected void onSeekTargetStep(int dx, int dy, RecyclerView.State state, Action action) {
+ protected void onSeekTargetStep(int dx, int dy, @NonNull RecyclerView.State state,
+ @NonNull Action action) {
// TODO(b/72745539): Is there ever a time when onSeekTargetStep should be called when
// getChildCount returns 0? Should this logic be extracted out of this method such that
// this method is not called if getChildCount() returns 0?
@@ -162,7 +168,7 @@
* @return The time (in ms) it should take for each pixel. For instance, if returned value is
* 2 ms, it means scrolling 1000 pixels with LinearInterpolation should take 2 seconds.
*/
- protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
+ protected float calculateSpeedPerPixel(@NonNull DisplayMetrics displayMetrics) {
return MILLISECONDS_PER_INCH / displayMetrics.densityDpi;
}
@@ -239,7 +245,7 @@
*
* @see #computeScrollVectorForPosition(int)
*/
- protected void updateActionForInterimTarget(Action action) {
+ protected void updateActionForInterimTarget(@NonNull Action action) {
// find an interim target position
PointF scrollVector = computeScrollVectorForPosition(getTargetPosition());
if (scrollVector == null || (scrollVector.x == 0 && scrollVector.y == 0)) {
@@ -310,7 +316,7 @@
* @return The vertical scroll amount necessary to make the view visible with the given
* snap preference.
*/
- public int calculateDyToMakeVisible(View view, int snapPreference) {
+ public int calculateDyToMakeVisible(@NonNull View view, int snapPreference) {
final RecyclerView.LayoutManager layoutManager = getLayoutManager();
if (layoutManager == null || !layoutManager.canScrollVertically()) {
return 0;
@@ -335,7 +341,7 @@
* @return The vertical scroll amount necessary to make the view visible with the given
* snap preference.
*/
- public int calculateDxToMakeVisible(View view, int snapPreference) {
+ public int calculateDxToMakeVisible(@NonNull View view, int snapPreference) {
final RecyclerView.LayoutManager layoutManager = getLayoutManager();
if (layoutManager == null || !layoutManager.canScrollHorizontally()) {
return 0;
diff --git a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/PagerSnapHelper.java b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/PagerSnapHelper.java
index 3e45a782d..9610ecf 100644
--- a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/PagerSnapHelper.java
+++ b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/PagerSnapHelper.java
@@ -67,7 +67,7 @@
@Nullable
@Override
- public View findSnapView(RecyclerView.LayoutManager layoutManager) {
+ public View findSnapView(@NonNull RecyclerView.LayoutManager layoutManager) {
if (layoutManager.canScrollVertically()) {
return findCenterView(layoutManager, getVerticalHelper(layoutManager));
} else if (layoutManager.canScrollHorizontally()) {
@@ -77,8 +77,8 @@
}
@Override
- public int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager, int velocityX,
- int velocityY) {
+ public int findTargetSnapPosition(@NonNull RecyclerView.LayoutManager layoutManager,
+ int velocityX, int velocityY) {
final int itemCount = layoutManager.getItemCount();
if (itemCount == 0) {
return RecyclerView.NO_POSITION;
@@ -173,7 +173,8 @@
}
return new LinearSmoothScroller(mRecyclerView.getContext()) {
@Override
- protected void onTargetFound(View targetView, RecyclerView.State state, Action action) {
+ protected void onTargetFound(@NonNull View targetView,
+ @NonNull RecyclerView.State state, @NonNull Action action) {
int[] snapDistances = calculateDistanceToFinalSnap(mRecyclerView.getLayoutManager(),
targetView);
final int dx = snapDistances[0];
@@ -185,7 +186,7 @@
}
@Override
- protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
+ protected float calculateSpeedPerPixel(@NonNull DisplayMetrics displayMetrics) {
return MILLISECONDS_PER_INCH / displayMetrics.densityDpi;
}
diff --git a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/SnapHelper.java b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/SnapHelper.java
index 072bd49..2473afe 100644
--- a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/SnapHelper.java
+++ b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/SnapHelper.java
@@ -133,6 +133,7 @@
* @return array holding the calculated distances in x and y directions
* respectively.
*/
+ @NonNull
public int[] calculateScrollDistance(int velocityX, int velocityY) {
int[] outDist = new int[2];
mGravityScroller.fling(0, 0, velocityX, velocityY,
@@ -286,7 +287,7 @@
*/
@SuppressWarnings("WeakerAccess")
@Nullable
- public abstract View findSnapView(RecyclerView.LayoutManager layoutManager);
+ public abstract View findSnapView(@NonNull RecyclerView.LayoutManager layoutManager);
/**
* Override to provide a particular adapter target position for snapping.
@@ -299,6 +300,7 @@
* @return the target adapter position to you want to snap or {@link RecyclerView#NO_POSITION}
* if no snapping should happen
*/
- public abstract int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager, int velocityX,
+ public abstract int findTargetSnapPosition(@NonNull RecyclerView.LayoutManager layoutManager,
+ int velocityX,
int velocityY);
}
diff --git a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/SortedList.java b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/SortedList.java
index 54e46f9..fbfdc72 100644
--- a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/SortedList.java
+++ b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/SortedList.java
@@ -862,7 +862,7 @@
abstract public void onChanged(int position, int count);
@Override
- public void onChanged(int position, int count, Object payload) {
+ public void onChanged(int position, int count, @Nullable Object payload) {
onChanged(position, count);
}
@@ -948,7 +948,7 @@
* Other method calls (e.g. {@link #compare(Object, Object)} from
* the SortedList are directly forwarded to this Callback.
*/
- public BatchedCallback(Callback<T2> wrappedCallback) {
+ public BatchedCallback(@NonNull Callback<T2> wrappedCallback) {
mWrappedCallback = wrappedCallback;
mBatchingListUpdateCallback = new BatchingListUpdateCallback(mWrappedCallback);
}
@@ -979,7 +979,7 @@
}
@Override
- public void onChanged(int position, int count, Object payload) {
+ public void onChanged(int position, int count, @Nullable Object payload) {
mBatchingListUpdateCallback.onChanged(position, count, payload);
}
diff --git a/remotecallback/remotecallback/api/current.txt b/remotecallback/remotecallback/api/current.txt
index 10d67d4..7dee39c 100644
--- a/remotecallback/remotecallback/api/current.txt
+++ b/remotecallback/remotecallback/api/current.txt
@@ -3,35 +3,35 @@
public class AppWidgetProviderWithCallbacks<T extends androidx.remotecallback.CallbackReceiver> extends android.appwidget.AppWidgetProvider implements androidx.remotecallback.CallbackReceiver<T> {
ctor public AppWidgetProviderWithCallbacks();
- method public T! createRemoteCallback(android.content.Context!);
+ method public T createRemoteCallback(android.content.Context);
}
public abstract class BroadcastReceiverWithCallbacks<T extends androidx.remotecallback.CallbackReceiver> extends android.content.BroadcastReceiver implements androidx.remotecallback.CallbackReceiver<T> {
ctor public BroadcastReceiverWithCallbacks();
- method public T! createRemoteCallback(android.content.Context!);
+ method public T createRemoteCallback(android.content.Context);
method public void onReceive(android.content.Context!, android.content.Intent!);
field public static final String ACTION_BROADCAST_CALLBACK = "androidx.remotecallback.action.BROADCAST_CALLBACK";
}
public class CallbackHandlerRegistry {
ctor public CallbackHandlerRegistry();
- method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context!, T!, android.content.Intent!);
- method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context!, T!, android.os.Bundle!);
- method public static <T extends androidx.remotecallback.CallbackReceiver> void registerCallbackHandler(Class<T!>!, String!, androidx.remotecallback.CallbackHandlerRegistry.CallbackHandler<T!>!);
- method public static androidx.remotecallback.RemoteCallback! stubToRemoteCallback(androidx.remotecallback.CallbackReceiver!, Class<? extends androidx.remotecallback.CallbackReceiver>!, android.os.Bundle!, String!);
+ method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context, T!, android.content.Intent);
+ method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context, T!, android.os.Bundle);
+ method public static <T extends androidx.remotecallback.CallbackReceiver> void registerCallbackHandler(Class<T!>, String, androidx.remotecallback.CallbackHandlerRegistry.CallbackHandler<T!>?);
+ method public static androidx.remotecallback.RemoteCallback? stubToRemoteCallback(androidx.remotecallback.CallbackReceiver, Class<? extends androidx.remotecallback.CallbackReceiver>, android.os.Bundle, String?);
}
public static interface CallbackHandlerRegistry.CallbackHandler<T extends androidx.remotecallback.CallbackReceiver> {
- method public void executeCallback(android.content.Context!, T!, android.os.Bundle!);
+ method public void executeCallback(android.content.Context, T!, android.os.Bundle);
}
public interface CallbackReceiver<T> {
- method public T! createRemoteCallback(android.content.Context!);
+ method public T createRemoteCallback(android.content.Context);
}
public abstract class ContentProviderWithCallbacks<T extends androidx.remotecallback.ContentProviderWithCallbacks> extends android.content.ContentProvider implements androidx.remotecallback.CallbackReceiver<T> {
ctor public ContentProviderWithCallbacks();
- method public T! createRemoteCallback(android.content.Context!);
+ method public T createRemoteCallback(android.content.Context);
}
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target(java.lang.annotation.ElementType.PARAMETER) public @interface ExternalInput {
diff --git a/remotecallback/remotecallback/api/public_plus_experimental_current.txt b/remotecallback/remotecallback/api/public_plus_experimental_current.txt
index 10d67d4..7dee39c 100644
--- a/remotecallback/remotecallback/api/public_plus_experimental_current.txt
+++ b/remotecallback/remotecallback/api/public_plus_experimental_current.txt
@@ -3,35 +3,35 @@
public class AppWidgetProviderWithCallbacks<T extends androidx.remotecallback.CallbackReceiver> extends android.appwidget.AppWidgetProvider implements androidx.remotecallback.CallbackReceiver<T> {
ctor public AppWidgetProviderWithCallbacks();
- method public T! createRemoteCallback(android.content.Context!);
+ method public T createRemoteCallback(android.content.Context);
}
public abstract class BroadcastReceiverWithCallbacks<T extends androidx.remotecallback.CallbackReceiver> extends android.content.BroadcastReceiver implements androidx.remotecallback.CallbackReceiver<T> {
ctor public BroadcastReceiverWithCallbacks();
- method public T! createRemoteCallback(android.content.Context!);
+ method public T createRemoteCallback(android.content.Context);
method public void onReceive(android.content.Context!, android.content.Intent!);
field public static final String ACTION_BROADCAST_CALLBACK = "androidx.remotecallback.action.BROADCAST_CALLBACK";
}
public class CallbackHandlerRegistry {
ctor public CallbackHandlerRegistry();
- method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context!, T!, android.content.Intent!);
- method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context!, T!, android.os.Bundle!);
- method public static <T extends androidx.remotecallback.CallbackReceiver> void registerCallbackHandler(Class<T!>!, String!, androidx.remotecallback.CallbackHandlerRegistry.CallbackHandler<T!>!);
- method public static androidx.remotecallback.RemoteCallback! stubToRemoteCallback(androidx.remotecallback.CallbackReceiver!, Class<? extends androidx.remotecallback.CallbackReceiver>!, android.os.Bundle!, String!);
+ method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context, T!, android.content.Intent);
+ method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context, T!, android.os.Bundle);
+ method public static <T extends androidx.remotecallback.CallbackReceiver> void registerCallbackHandler(Class<T!>, String, androidx.remotecallback.CallbackHandlerRegistry.CallbackHandler<T!>?);
+ method public static androidx.remotecallback.RemoteCallback? stubToRemoteCallback(androidx.remotecallback.CallbackReceiver, Class<? extends androidx.remotecallback.CallbackReceiver>, android.os.Bundle, String?);
}
public static interface CallbackHandlerRegistry.CallbackHandler<T extends androidx.remotecallback.CallbackReceiver> {
- method public void executeCallback(android.content.Context!, T!, android.os.Bundle!);
+ method public void executeCallback(android.content.Context, T!, android.os.Bundle);
}
public interface CallbackReceiver<T> {
- method public T! createRemoteCallback(android.content.Context!);
+ method public T createRemoteCallback(android.content.Context);
}
public abstract class ContentProviderWithCallbacks<T extends androidx.remotecallback.ContentProviderWithCallbacks> extends android.content.ContentProvider implements androidx.remotecallback.CallbackReceiver<T> {
ctor public ContentProviderWithCallbacks();
- method public T! createRemoteCallback(android.content.Context!);
+ method public T createRemoteCallback(android.content.Context);
}
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target(java.lang.annotation.ElementType.PARAMETER) public @interface ExternalInput {
diff --git a/remotecallback/remotecallback/api/restricted_current.txt b/remotecallback/remotecallback/api/restricted_current.txt
index c47d0eb..959ea1b 100644
--- a/remotecallback/remotecallback/api/restricted_current.txt
+++ b/remotecallback/remotecallback/api/restricted_current.txt
@@ -3,44 +3,44 @@
public class AppWidgetProviderWithCallbacks<T extends androidx.remotecallback.CallbackReceiver> extends android.appwidget.AppWidgetProvider implements androidx.remotecallback.CallbackBase<T> androidx.remotecallback.CallbackReceiver<T> {
ctor public AppWidgetProviderWithCallbacks();
- method public T! createRemoteCallback(android.content.Context!);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.remotecallback.RemoteCallback! toRemoteCallback(Class<T!>!, android.content.Context!, String!, android.os.Bundle!, String!);
+ method public T createRemoteCallback(android.content.Context);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.remotecallback.RemoteCallback toRemoteCallback(Class<T!>, android.content.Context, String?, android.os.Bundle, String);
}
public abstract class BroadcastReceiverWithCallbacks<T extends androidx.remotecallback.CallbackReceiver> extends android.content.BroadcastReceiver implements androidx.remotecallback.CallbackBase<T> androidx.remotecallback.CallbackReceiver<T> {
ctor public BroadcastReceiverWithCallbacks();
- method public T! createRemoteCallback(android.content.Context!);
+ method public T createRemoteCallback(android.content.Context);
method public void onReceive(android.content.Context!, android.content.Intent!);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.remotecallback.RemoteCallback! toRemoteCallback(Class<T!>!, android.content.Context!, String!, android.os.Bundle!, String!);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.remotecallback.RemoteCallback toRemoteCallback(Class<T!>, android.content.Context, String?, android.os.Bundle, String);
field public static final String ACTION_BROADCAST_CALLBACK = "androidx.remotecallback.action.BROADCAST_CALLBACK";
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public interface CallbackBase<T> {
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.remotecallback.RemoteCallback! toRemoteCallback(Class<T!>!, android.content.Context!, String!, android.os.Bundle!, String!);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.remotecallback.RemoteCallback toRemoteCallback(Class<T!>, android.content.Context, String, android.os.Bundle, String);
}
public class CallbackHandlerRegistry {
ctor public CallbackHandlerRegistry();
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public <T extends androidx.remotecallback.CallbackReceiver> T! getAndResetStub(Class<? extends androidx.remotecallback.CallbackReceiver>!, android.content.Context!, String!);
- method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context!, T!, android.content.Intent!);
- method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context!, T!, android.os.Bundle!);
- method public static <T extends androidx.remotecallback.CallbackReceiver> void registerCallbackHandler(Class<T!>!, String!, androidx.remotecallback.CallbackHandlerRegistry.CallbackHandler<T!>!);
- method public static androidx.remotecallback.RemoteCallback! stubToRemoteCallback(androidx.remotecallback.CallbackReceiver!, Class<? extends androidx.remotecallback.CallbackReceiver>!, android.os.Bundle!, String!);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public <T extends androidx.remotecallback.CallbackReceiver> T getAndResetStub(Class<? extends androidx.remotecallback.CallbackReceiver>, android.content.Context, String?);
+ method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context, T!, android.content.Intent);
+ method public <T extends androidx.remotecallback.CallbackReceiver> void invokeCallback(android.content.Context, T!, android.os.Bundle);
+ method public static <T extends androidx.remotecallback.CallbackReceiver> void registerCallbackHandler(Class<T!>, String, androidx.remotecallback.CallbackHandlerRegistry.CallbackHandler<T!>?);
+ method public static androidx.remotecallback.RemoteCallback? stubToRemoteCallback(androidx.remotecallback.CallbackReceiver, Class<? extends androidx.remotecallback.CallbackReceiver>, android.os.Bundle, String?);
field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static final androidx.remotecallback.CallbackHandlerRegistry! sInstance;
}
public static interface CallbackHandlerRegistry.CallbackHandler<T extends androidx.remotecallback.CallbackReceiver> {
- method public void executeCallback(android.content.Context!, T!, android.os.Bundle!);
+ method public void executeCallback(android.content.Context, T!, android.os.Bundle);
}
public interface CallbackReceiver<T> {
- method public T! createRemoteCallback(android.content.Context!);
+ method public T createRemoteCallback(android.content.Context);
}
public abstract class ContentProviderWithCallbacks<T extends androidx.remotecallback.ContentProviderWithCallbacks> extends android.content.ContentProvider implements androidx.remotecallback.CallbackBase<T> androidx.remotecallback.CallbackReceiver<T> {
ctor public ContentProviderWithCallbacks();
- method public T! createRemoteCallback(android.content.Context!);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.remotecallback.RemoteCallback! toRemoteCallback(Class<T!>!, android.content.Context!, String!, android.os.Bundle!, String!);
+ method public T createRemoteCallback(android.content.Context);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.remotecallback.RemoteCallback toRemoteCallback(Class<T!>, android.content.Context, String?, android.os.Bundle, String);
}
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target(java.lang.annotation.ElementType.PARAMETER) public @interface ExternalInput {
diff --git a/remotecallback/remotecallback/lint-baseline.xml b/remotecallback/remotecallback/lint-baseline.xml
index 9fc3f41..ba213831 100644
--- a/remotecallback/remotecallback/lint-baseline.xml
+++ b/remotecallback/remotecallback/lint-baseline.xml
@@ -11,15 +11,6 @@
</issue>
<issue
- id="LambdaLast"
- message="Functional interface parameters (such as parameter 1, "receiver", in androidx.remotecallback.CallbackHandlerRegistry.stubToRemoteCallback) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions"
- errorLine1=" Class<? extends CallbackReceiver> cls, Bundle args, String method) {"
- errorLine2=" ~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
errorLine1=" public T createRemoteCallback(Context context) {"
@@ -202,159 +193,6 @@
<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public <T extends CallbackReceiver> T getAndResetStub(Class<? extends CallbackReceiver> cls,"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" Context context, String authority) {"
- errorLine2=" ~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" Context context, String authority) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public <T extends CallbackReceiver> void invokeCallback(Context context, T receiver,"
- errorLine2=" ~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" Intent intent) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public <T extends CallbackReceiver> void invokeCallback(Context context, T receiver,"
- errorLine2=" ~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" Bundle bundle) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public static <T extends CallbackReceiver> void registerCallbackHandler(Class<T> cls,"
- errorLine2=" ~~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" String method, CallbackHandler<T> handler) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" String method, CallbackHandler<T> handler) {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public static RemoteCallback stubToRemoteCallback(CallbackReceiver receiver,"
- errorLine2=" ~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public static RemoteCallback stubToRemoteCallback(CallbackReceiver receiver,"
- errorLine2=" ~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" Class<? extends CallbackReceiver> cls, Bundle args, String method) {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" Class<? extends CallbackReceiver> cls, Bundle args, String method) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" Class<? extends CallbackReceiver> cls, Bundle args, String method) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" void executeCallback(Context context, T receiver, Bundle arguments);"
- errorLine2=" ~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" void executeCallback(Context context, T receiver, Bundle arguments);"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
errorLine1=" T createRemoteCallback(Context context);"
errorLine2=" ~~~~~~~">
<location
@@ -364,105 +202,6 @@
<issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public Bundle call(String method, String arg, Bundle extras) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public Bundle call(String method, String arg, Bundle extras) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public Bundle call(String method, String arg, Bundle extras) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public Bundle call(String method, String arg, Bundle extras) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public T createRemoteCallback(Context context) {"
- errorLine2=" ~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public RemoteCallback toRemoteCallback(Class<T> cls, Context context, String authority,"
- errorLine2=" ~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public RemoteCallback toRemoteCallback(Class<T> cls, Context context, String authority,"
- errorLine2=" ~~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public RemoteCallback toRemoteCallback(Class<T> cls, Context context, String authority,"
- errorLine2=" ~~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" public RemoteCallback toRemoteCallback(Class<T> cls, Context context, String authority,"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" Bundle args, String method) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
- errorLine1=" Bundle args, String method) {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java"/>
- </issue>
-
- <issue
- id="UnknownNullness"
- message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
errorLine1=" public String getMethodName() {"
errorLine2=" ~~~~~~">
<location
diff --git a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/AppWidgetProviderWithCallbacks.java b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/AppWidgetProviderWithCallbacks.java
index c1620a6..ac48da8 100644
--- a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/AppWidgetProviderWithCallbacks.java
+++ b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/AppWidgetProviderWithCallbacks.java
@@ -25,6 +25,8 @@
import android.content.Intent;
import android.os.Bundle;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
/**
@@ -46,18 +48,21 @@
}
}
+ @NonNull
@Override
- public T createRemoteCallback(Context context) {
+ public T createRemoteCallback(@NonNull Context context) {
return CallbackHandlerRegistry.sInstance.getAndResetStub(getClass(), context, null);
}
/**
* @hide
*/
+ @NonNull
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
@Override
- public RemoteCallback toRemoteCallback(Class<T> cls, Context context, String authority,
- Bundle args, String method) {
+ public RemoteCallback toRemoteCallback(@NonNull Class<T> cls, @NonNull Context context,
+ @Nullable String authority,
+ @NonNull Bundle args, @NonNull String method) {
Intent intent = new Intent(ACTION_BROADCAST_CALLBACK);
intent.setComponent(new ComponentName(context.getPackageName(), cls.getName()));
args.putString(EXTRA_METHOD, method);
diff --git a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/BroadcastReceiverWithCallbacks.java b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/BroadcastReceiverWithCallbacks.java
index 4b022c4..dcf4282 100644
--- a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/BroadcastReceiverWithCallbacks.java
+++ b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/BroadcastReceiverWithCallbacks.java
@@ -25,6 +25,8 @@
import android.content.Intent;
import android.os.Bundle;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
/**
@@ -52,18 +54,21 @@
}
}
+ @NonNull
@Override
- public T createRemoteCallback(Context context) {
+ public T createRemoteCallback(@NonNull Context context) {
return CallbackHandlerRegistry.sInstance.getAndResetStub(getClass(), context, null);
}
/**
* @hide
*/
+ @NonNull
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
@Override
- public RemoteCallback toRemoteCallback(Class<T> cls, Context context, String authority,
- Bundle args, String method) {
+ public RemoteCallback toRemoteCallback(@NonNull Class<T> cls, @NonNull Context context,
+ @Nullable String authority,
+ @NonNull Bundle args, @NonNull String method) {
Intent intent = new Intent(ACTION_BROADCAST_CALLBACK);
intent.setComponent(new ComponentName(context.getPackageName(), cls.getName()));
args.putString(EXTRA_METHOD, method);
diff --git a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackBase.java b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackBase.java
index c12453e..a07801a 100644
--- a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackBase.java
+++ b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackBase.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.os.Bundle;
+import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
/**
@@ -38,7 +39,9 @@
* be used in the context on {@link CallbackReceiver#createRemoteCallback}.
* @hide
*/
+ @NonNull
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
- RemoteCallback toRemoteCallback(Class<T> cls, Context context, String authority, Bundle args,
- String method);
+ RemoteCallback toRemoteCallback(@NonNull Class<T> cls, @NonNull Context context,
+ @NonNull String authority, @NonNull Bundle args,
+ @NonNull String method);
}
diff --git a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java
index 74e14cf..588fc86 100644
--- a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java
+++ b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackHandlerRegistry.java
@@ -18,6 +18,7 @@
import static androidx.remotecallback.RemoteCallback.EXTRA_METHOD;
+import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.ContentProvider;
import android.content.Context;
@@ -27,6 +28,8 @@
import android.os.Bundle;
import android.util.Log;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.collection.SimpleArrayMap;
@@ -50,10 +53,12 @@
/**
* @hide
*/
+ @NonNull
@SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
- public <T extends CallbackReceiver> T getAndResetStub(Class<? extends CallbackReceiver> cls,
- Context context, String authority) {
+ public <T extends CallbackReceiver> T getAndResetStub(
+ @NonNull Class<? extends CallbackReceiver> cls,
+ @NonNull Context context, @Nullable String authority) {
ensureInitialized(cls);
ClsHandler stub = findMap(cls);
initStub(stub.mCallStub, cls, context, authority);
@@ -99,8 +104,8 @@
* Trigger a call to a callback using arguments that were generated with
* {@link RemoteCallback#getArgumentBundle()}.
*/
- public <T extends CallbackReceiver> void invokeCallback(Context context, T receiver,
- Intent intent) {
+ public <T extends CallbackReceiver> void invokeCallback(@NonNull Context context, T receiver,
+ @NonNull Intent intent) {
invokeCallback(context, receiver, intent.getExtras());
}
@@ -108,8 +113,8 @@
* Trigger a call to a callback using arguments that were generated with
* {@link RemoteCallback#getArgumentBundle()}.
*/
- public <T extends CallbackReceiver> void invokeCallback(Context context, T receiver,
- Bundle bundle) {
+ public <T extends CallbackReceiver> void invokeCallback(@NonNull Context context, T receiver,
+ @NonNull Bundle bundle) {
Class<? extends CallbackReceiver> receiverClass = receiver.getClass();
ensureInitialized(receiverClass);
ClsHandler map = findMap(receiverClass);
@@ -185,8 +190,8 @@
* Note: This should only be called by generated code, there is no reason to reference this
* otherwise.
*/
- public static <T extends CallbackReceiver> void registerCallbackHandler(Class<T> cls,
- String method, CallbackHandler<T> handler) {
+ public static <T extends CallbackReceiver> void registerCallbackHandler(@NonNull Class<T> cls,
+ @NonNull String method, @Nullable CallbackHandler<T> handler) {
sInstance.registerHandler(cls, method, handler);
}
@@ -195,9 +200,12 @@
* Note: This should only be called by generated code, there is no reason to reference this
* otherwise.
*/
+ @Nullable
@SuppressWarnings("unchecked")
- public static RemoteCallback stubToRemoteCallback(CallbackReceiver receiver,
- Class<? extends CallbackReceiver> cls, Bundle args, String method) {
+ @SuppressLint("LambdaLast")
+ public static RemoteCallback stubToRemoteCallback(@NonNull CallbackReceiver receiver,
+ @NonNull Class<? extends CallbackReceiver> cls, @NonNull Bundle args,
+ @Nullable String method) {
if (!(receiver instanceof CallbackBase)) {
throw new IllegalArgumentException(
"May only be called on classes that extend a *WithCallbacks base class.");
@@ -232,6 +240,6 @@
* Note: This should only be called by generated code, there is no reason to reference this
* otherwise.
*/
- void executeCallback(Context context, T receiver, Bundle arguments);
+ void executeCallback(@NonNull Context context, T receiver, @NonNull Bundle arguments);
}
}
diff --git a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackReceiver.java b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackReceiver.java
index 10882a8..b358a98 100644
--- a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackReceiver.java
+++ b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/CallbackReceiver.java
@@ -18,6 +18,8 @@
import android.content.Context;
+import androidx.annotation.NonNull;
+
/**
* An objects that can receive remote callbacks.
* <p>
@@ -104,5 +106,6 @@
* }
* </pre>
*/
- T createRemoteCallback(Context context);
+ @NonNull
+ T createRemoteCallback(@NonNull Context context);
}
diff --git a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java
index b4c4bf6..47ce70d 100644
--- a/remotecallback/remotecallback/src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java
+++ b/remotecallback/remotecallback/src/main/java/androidx/remotecallback/ContentProviderWithCallbacks.java
@@ -27,6 +27,8 @@
import android.content.pm.ProviderInfo;
import android.os.Bundle;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
/**
@@ -50,8 +52,9 @@
mAuthority = info.authority;
}
+ @Nullable
@Override
- public Bundle call(String method, String arg, Bundle extras) {
+ public Bundle call(@NonNull String method, @Nullable String arg, @Nullable Bundle extras) {
if (ProviderRelayReceiver.METHOD_PROVIDER_CALLBACK.equals(method)) {
CallbackHandlerRegistry.sInstance.invokeCallback(getContext(), this, extras);
return null;
@@ -59,22 +62,22 @@
return super.call(method, arg, extras);
}
+ @NonNull
@Override
- public T createRemoteCallback(Context context) {
+ public T createRemoteCallback(@NonNull Context context) {
return CallbackHandlerRegistry.sInstance.getAndResetStub(getClass(), context, mAuthority);
}
/**
* @hide
*/
+ @NonNull
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
@Override
- public RemoteCallback toRemoteCallback(Class<T> cls, Context context, String authority,
- Bundle args, String method) {
- if (authority == null) {
- throw new IllegalStateException(
- "ContentProvider must be attached before creating callbacks");
- }
+ public RemoteCallback toRemoteCallback(@NonNull Class<T> cls, @NonNull Context context,
+ @Nullable String authority,
+ @NonNull Bundle args, @NonNull String method) {
+
Intent intent = new Intent(ACTION_PROVIDER_RELAY);
intent.setComponent(new ComponentName(context.getPackageName(),
ProviderRelayReceiver.class.getName()));
diff --git a/settings.gradle b/settings.gradle
index 5bd00f2..bd19f12 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -21,8 +21,8 @@
repos.addMavenRepositories(repositories)
dependencies {
- classpath("com.gradle:gradle-enterprise-gradle-plugin:3.10.1")
- classpath("com.gradle:common-custom-user-data-gradle-plugin:1.6.5")
+ classpath("com.gradle:gradle-enterprise-gradle-plugin:3.10.2")
+ classpath("com.gradle:common-custom-user-data-gradle-plugin:1.7.2")
classpath("androidx.build.gradle.gcpbuildcache:gcpbuildcache:1.0.0-alpha05")
}
}
diff --git a/slice/slice-core/api/current.txt b/slice/slice-core/api/current.txt
index 4fa5dd0..8bd0958 100644
--- a/slice/slice-core/api/current.txt
+++ b/slice/slice-core/api/current.txt
@@ -2,9 +2,9 @@
package androidx.slice {
@RequiresApi(19) public final class Slice implements androidx.versionedparcelable.VersionedParcelable {
- method public java.util.List<java.lang.String!>! getHints();
- method public java.util.List<androidx.slice.SliceItem!>! getItems();
- method public android.net.Uri! getUri();
+ method public java.util.List<java.lang.String!> getHints();
+ method public java.util.List<androidx.slice.SliceItem!> getItems();
+ method public android.net.Uri getUri();
field public static final String EXTRA_SELECTION = "android.app.slice.extra.SELECTION";
}
diff --git a/slice/slice-core/api/public_plus_experimental_current.txt b/slice/slice-core/api/public_plus_experimental_current.txt
index 4fa5dd0..8bd0958 100644
--- a/slice/slice-core/api/public_plus_experimental_current.txt
+++ b/slice/slice-core/api/public_plus_experimental_current.txt
@@ -2,9 +2,9 @@
package androidx.slice {
@RequiresApi(19) public final class Slice implements androidx.versionedparcelable.VersionedParcelable {
- method public java.util.List<java.lang.String!>! getHints();
- method public java.util.List<androidx.slice.SliceItem!>! getItems();
- method public android.net.Uri! getUri();
+ method public java.util.List<java.lang.String!> getHints();
+ method public java.util.List<androidx.slice.SliceItem!> getItems();
+ method public android.net.Uri getUri();
field public static final String EXTRA_SELECTION = "android.app.slice.extra.SELECTION";
}
diff --git a/slice/slice-core/api/restricted_current.txt b/slice/slice-core/api/restricted_current.txt
index ef1ce38..e0bbc2f 100644
--- a/slice/slice-core/api/restricted_current.txt
+++ b/slice/slice-core/api/restricted_current.txt
@@ -10,12 +10,12 @@
}
@RequiresApi(19) @androidx.versionedparcelable.VersionedParcelize(allowSerialization=true, isCustom=true) public final class Slice extends androidx.versionedparcelable.CustomVersionedParcelable implements androidx.versionedparcelable.VersionedParcelable {
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static androidx.slice.Slice? bindSlice(android.content.Context!, android.net.Uri, java.util.Set<androidx.slice.SliceSpec!>!);
- method public java.util.List<java.lang.String!>! getHints();
- method public java.util.List<androidx.slice.SliceItem!>! getItems();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static androidx.slice.Slice? bindSlice(android.content.Context, android.net.Uri, java.util.Set<androidx.slice.SliceSpec!>?);
+ method public java.util.List<java.lang.String!> getHints();
+ method public java.util.List<androidx.slice.SliceItem!> getItems();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.slice.SliceSpec? getSpec();
- method public android.net.Uri! getUri();
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public boolean hasHint(String!);
+ method public android.net.Uri getUri();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public boolean hasHint(String);
field public static final String EXTRA_SELECTION = "android.app.slice.extra.SELECTION";
field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static final String SUBTYPE_RANGE_MODE = "range_mode";
}
@@ -23,27 +23,27 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class Slice.Builder {
ctor public Slice.Builder(android.net.Uri);
ctor public Slice.Builder(androidx.slice.Slice.Builder);
- method public androidx.slice.Slice.Builder! addAction(android.app.PendingIntent, androidx.slice.Slice, String?);
- method public androidx.slice.Slice.Builder! addAction(androidx.slice.SliceItem.ActionHandler, androidx.slice.Slice, String?);
- method public androidx.slice.Slice.Builder! addHints(java.lang.String!...);
- method public androidx.slice.Slice.Builder! addHints(java.util.List<java.lang.String!>!);
- method public androidx.slice.Slice.Builder! addIcon(androidx.core.graphics.drawable.IconCompat!, String?, java.lang.String!...);
- method public androidx.slice.Slice.Builder! addIcon(androidx.core.graphics.drawable.IconCompat!, String?, java.util.List<java.lang.String!>!);
- method public androidx.slice.Slice.Builder! addInt(int, String?, java.lang.String!...);
- method public androidx.slice.Slice.Builder! addInt(int, String?, java.util.List<java.lang.String!>!);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public androidx.slice.Slice.Builder! addItem(androidx.slice.SliceItem!);
- method public androidx.slice.Slice.Builder! addLong(long, String?, java.lang.String!...);
- method public androidx.slice.Slice.Builder! addLong(long, String?, java.util.List<java.lang.String!>!);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.slice.Slice.Builder! addRemoteInput(android.app.RemoteInput!, String?, java.util.List<java.lang.String!>!);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.slice.Slice.Builder! addRemoteInput(android.app.RemoteInput!, String?, java.lang.String!...);
- method public androidx.slice.Slice.Builder! addSubSlice(androidx.slice.Slice);
- method public androidx.slice.Slice.Builder! addSubSlice(androidx.slice.Slice, String!);
- method public androidx.slice.Slice.Builder! addText(CharSequence!, String?, java.lang.String!...);
- method public androidx.slice.Slice.Builder! addText(CharSequence!, String?, java.util.List<java.lang.String!>!);
+ method public androidx.slice.Slice.Builder addAction(android.app.PendingIntent, androidx.slice.Slice, String?);
+ method public androidx.slice.Slice.Builder addAction(androidx.slice.Slice, String?, androidx.slice.SliceItem.ActionHandler);
+ method public androidx.slice.Slice.Builder addHints(java.lang.String!...);
+ method public androidx.slice.Slice.Builder addHints(java.util.List<java.lang.String!>);
+ method public androidx.slice.Slice.Builder addIcon(androidx.core.graphics.drawable.IconCompat, String?, java.lang.String!...);
+ method public androidx.slice.Slice.Builder addIcon(androidx.core.graphics.drawable.IconCompat, String?, java.util.List<java.lang.String!>);
+ method public androidx.slice.Slice.Builder addInt(int, String?, java.lang.String!...);
+ method public androidx.slice.Slice.Builder addInt(int, String?, java.util.List<java.lang.String!>);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public androidx.slice.Slice.Builder addItem(androidx.slice.SliceItem);
+ method public androidx.slice.Slice.Builder addLong(long, String?, java.lang.String!...);
+ method public androidx.slice.Slice.Builder addLong(long, String?, java.util.List<java.lang.String!>);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.slice.Slice.Builder addRemoteInput(android.app.RemoteInput, String?, java.util.List<java.lang.String!>);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.slice.Slice.Builder addRemoteInput(android.app.RemoteInput, String?, java.lang.String!...);
+ method public androidx.slice.Slice.Builder addSubSlice(androidx.slice.Slice);
+ method public androidx.slice.Slice.Builder addSubSlice(androidx.slice.Slice, String?);
+ method public androidx.slice.Slice.Builder addText(CharSequence?, String?, java.lang.String!...);
+ method public androidx.slice.Slice.Builder addText(CharSequence?, String?, java.util.List<java.lang.String!>);
method @Deprecated public androidx.slice.Slice.Builder! addTimestamp(long, String?, java.lang.String!...);
- method public androidx.slice.Slice.Builder! addTimestamp(long, String?, java.util.List<java.lang.String!>!);
- method public androidx.slice.Slice! build();
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.slice.Slice.Builder! setSpec(androidx.slice.SliceSpec!);
+ method public androidx.slice.Slice.Builder addTimestamp(long, String?, java.util.List<java.lang.String!>);
+ method public androidx.slice.Slice build();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.slice.Slice.Builder setSpec(androidx.slice.SliceSpec?);
}
@RequiresApi(28) public class SliceConvert {
diff --git a/slice/slice-core/src/main/java/androidx/slice/Slice.java b/slice/slice-core/src/main/java/androidx/slice/Slice.java
index 797c4a1..d7cf29b 100644
--- a/slice/slice-core/src/main/java/androidx/slice/Slice.java
+++ b/slice/slice-core/src/main/java/androidx/slice/Slice.java
@@ -51,6 +51,7 @@
import static androidx.slice.core.SliceHints.HINT_SELECTION_OPTION;
import static androidx.slice.core.SliceHints.HINT_SHOW_LABEL;
+import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.app.RemoteInput;
import android.app.slice.SliceManager;
@@ -61,6 +62,7 @@
import android.os.Bundle;
import android.os.Parcelable;
+import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
@@ -186,7 +188,7 @@
*/
@RestrictTo(Scope.LIBRARY)
@SuppressWarnings("deprecation")
- public Slice(Bundle in) {
+ public Slice(@NonNull Bundle in) {
mHints = in.getStringArray(HINTS);
Parcelable[] items = in.getParcelableArray(ITEMS);
mItems = new SliceItem[items.length];
@@ -205,7 +207,7 @@
* @hide
*/
@RestrictTo(Scope.LIBRARY)
- public Bundle toBundle() {
+ public @NonNull Bundle toBundle() {
Bundle b = new Bundle();
b.putStringArray(HINTS, mHints);
Parcelable[] p = new Parcelable[mItems.length];
@@ -233,14 +235,14 @@
/**
* @return The Uri that this Slice represents.
*/
- public Uri getUri() {
+ public @NonNull Uri getUri() {
return Uri.parse(mUri);
}
/**
* @return All child {@link SliceItem}s that this Slice contains.
*/
- public List<SliceItem> getItems() {
+ public @NonNull List<SliceItem> getItems() {
return Arrays.asList(mItems);
}
@@ -249,14 +251,14 @@
* @return
*/
@RestrictTo(LIBRARY)
- public SliceItem[] getItemArray() {
+ public @NonNull SliceItem[] getItemArray() {
return mItems;
}
/**
* @return All hints associated with this Slice.
*/
- public @SliceHint List<String> getHints() {
+ public @NonNull @SliceHint List<String> getHints() {
return Arrays.asList(mHints);
}
@@ -264,7 +266,7 @@
* @hide
*/
@RestrictTo(LIBRARY)
- public @SliceHint String[] getHintArray() {
+ public @NonNull @SliceHint String[] getHintArray() {
return mHints;
}
@@ -272,7 +274,7 @@
* @hide
*/
@RestrictTo(Scope.LIBRARY_GROUP_PREFIX)
- public boolean hasHint(@SliceHint String hint) {
+ public boolean hasHint(@NonNull @SliceHint String hint) {
return ArrayUtils.contains(mHints, hint);
}
@@ -326,7 +328,7 @@
* being constructed by the provided builder.
* @param parent The builder constructing the parent slice
*/
- public Builder(@NonNull Slice.Builder parent) {
+ public Builder(@NonNull Builder parent) {
mUri = parent.getChildUri();
}
@@ -340,7 +342,7 @@
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
- public Builder setSpec(SliceSpec spec) {
+ public @NonNull Builder setSpec(@Nullable SliceSpec spec) {
mSpec = spec;
return this;
}
@@ -348,7 +350,7 @@
/**
* Add hints to the Slice being constructed
*/
- public Builder addHints(@SliceHint String... hints) {
+ public @NonNull Builder addHints(@NonNull @SliceHint String... hints) {
mHints.addAll(Arrays.asList(hints));
return this;
}
@@ -356,14 +358,14 @@
/**
* Add hints to the Slice being constructed
*/
- public Builder addHints(@SliceHint List<String> hints) {
+ public @NonNull Builder addHints(@NonNull @SliceHint List<String> hints) {
return addHints(hints.toArray(new String[hints.size()]));
}
/**
* Add a sub-slice to the slice being constructed
*/
- public Builder addSubSlice(@NonNull Slice slice) {
+ public @NonNull Builder addSubSlice(@NonNull Slice slice) {
Preconditions.checkNotNull(slice);
return addSubSlice(slice, null);
}
@@ -373,7 +375,7 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Builder addSubSlice(@NonNull Slice slice, String subType) {
+ public @NonNull Builder addSubSlice(@NonNull Slice slice, @Nullable String subType) {
Preconditions.checkNotNull(slice);
mItems.add(new SliceItem(slice, FORMAT_SLICE, subType, slice.getHintArray()));
return this;
@@ -384,7 +386,7 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Slice.Builder addAction(@NonNull PendingIntent action,
+ public @NonNull Builder addAction(@NonNull PendingIntent action,
@NonNull Slice s, @Nullable String subType) {
Preconditions.checkNotNull(action);
Preconditions.checkNotNull(s);
@@ -399,8 +401,8 @@
* @param action Callback to be triggered when a pending intent would normally be fired.
* @see SliceItem#getSubType()
*/
- public Slice.Builder addAction(@NonNull SliceItem.ActionHandler action,
- @NonNull Slice s, @Nullable String subType) {
+ public @NonNull Builder addAction(@NonNull Slice s, @Nullable String subType,
+ @NonNull SliceItem.ActionHandler action) {
Preconditions.checkNotNull(s);
@SliceHint String[] hints = s.getHintArray();
mItems.add(new SliceItem(action, s, FORMAT_ACTION, subType, hints));
@@ -412,8 +414,8 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Builder addText(CharSequence text, @Nullable String subType,
- @SliceHint String... hints) {
+ public @NonNull Builder addText(@Nullable CharSequence text, @Nullable String subType,
+ @NonNull @SliceHint String... hints) {
mItems.add(new SliceItem(text, FORMAT_TEXT, subType, hints));
return this;
}
@@ -423,8 +425,8 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Builder addText(CharSequence text, @Nullable String subType,
- @SliceHint List<String> hints) {
+ public @NonNull Builder addText(@Nullable CharSequence text, @Nullable String subType,
+ @NonNull @SliceHint List<String> hints) {
return addText(text, subType, hints.toArray(new String[hints.size()]));
}
@@ -433,8 +435,8 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Builder addIcon(IconCompat icon, @Nullable String subType,
- @SliceHint String... hints) {
+ public @NonNull Builder addIcon(@NonNull IconCompat icon, @Nullable String subType,
+ @NonNull @SliceHint String... hints) {
Preconditions.checkNotNull(icon);
if (isValidIcon(icon)) {
mItems.add(new SliceItem(icon, FORMAT_IMAGE, subType, hints));
@@ -447,8 +449,8 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Builder addIcon(IconCompat icon, @Nullable String subType,
- @SliceHint List<String> hints) {
+ public @NonNull Builder addIcon(@NonNull IconCompat icon, @Nullable String subType,
+ @NonNull @SliceHint List<String> hints) {
Preconditions.checkNotNull(icon);
if (isValidIcon(icon)) {
return addIcon(icon, subType, hints.toArray(new String[hints.size()]));
@@ -463,8 +465,8 @@
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
- public Slice.Builder addRemoteInput(RemoteInput remoteInput, @Nullable String subType,
- @SliceHint List<String> hints) {
+ public @NonNull Builder addRemoteInput(@NonNull RemoteInput remoteInput,
+ @Nullable String subType, @NonNull @SliceHint List<String> hints) {
Preconditions.checkNotNull(remoteInput);
return addRemoteInput(remoteInput, subType, hints.toArray(new String[hints.size()]));
}
@@ -476,8 +478,8 @@
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
- public Slice.Builder addRemoteInput(RemoteInput remoteInput, @Nullable String subType,
- @SliceHint String... hints) {
+ public @NonNull Builder addRemoteInput(@NonNull RemoteInput remoteInput,
+ @Nullable String subType, @NonNull @SliceHint String... hints) {
Preconditions.checkNotNull(remoteInput);
mItems.add(new SliceItem(remoteInput, FORMAT_REMOTE_INPUT, subType, hints));
return this;
@@ -488,8 +490,8 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Builder addInt(int value, @Nullable String subType,
- @SliceHint String... hints) {
+ public @NonNull Builder addInt(int value, @Nullable String subType,
+ @NonNull @SliceHint String... hints) {
mItems.add(new SliceItem(value, FORMAT_INT, subType, hints));
return this;
}
@@ -500,8 +502,8 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Builder addInt(int value, @Nullable String subType,
- @SliceHint List<String> hints) {
+ public @NonNull Builder addInt(int value, @Nullable String subType,
+ @NonNull @SliceHint List<String> hints) {
return addInt(value, subType, hints.toArray(new String[hints.size()]));
}
@@ -510,8 +512,8 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Slice.Builder addLong(long time, @Nullable String subType,
- @SliceHint String... hints) {
+ public @NonNull Builder addLong(long time, @Nullable String subType,
+ @NonNull @SliceHint String... hints) {
mItems.add(new SliceItem(time, FORMAT_LONG, subType, hints));
return this;
}
@@ -521,8 +523,8 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Slice.Builder addLong(long time, @Nullable String subType,
- @SliceHint List<String> hints) {
+ public @NonNull Builder addLong(long time, @Nullable String subType,
+ @NonNull @SliceHint List<String> hints) {
return addLong(time, subType, hints.toArray(new String[hints.size()]));
}
@@ -533,7 +535,7 @@
* @deprecated TO BE REMOVED
*/
@Deprecated
- public Slice.Builder addTimestamp(long time, @Nullable String subType,
+ public Builder addTimestamp(long time, @Nullable String subType,
@SliceHint String... hints) {
mItems.add(new SliceItem(time, FORMAT_LONG, subType, hints));
return this;
@@ -544,8 +546,8 @@
* @param subType Optional template-specific type information
* @see SliceItem#getSubType()
*/
- public Slice.Builder addTimestamp(long time, @Nullable String subType,
- @SliceHint List<String> hints) {
+ public @NonNull Builder addTimestamp(long time, @Nullable String subType,
+ @NonNull @SliceHint List<String> hints) {
return addTimestamp(time, subType, hints.toArray(new String[hints.size()]));
}
@@ -554,7 +556,7 @@
* @hide
*/
@RestrictTo(Scope.LIBRARY_GROUP)
- public Slice.Builder addItem(SliceItem item) {
+ public @NonNull Builder addItem(@NonNull SliceItem item) {
mItems.add(item);
return this;
}
@@ -562,7 +564,7 @@
/**
* Construct the slice.
*/
- public Slice build() {
+ public @NonNull Slice build() {
return new Slice(mItems, mHints.toArray(new String[mHints.size()]), mUri, mSpec);
}
}
@@ -570,6 +572,7 @@
/**
* @return A string representation of this slice.
*/
+ @NonNull
@Override
public String toString() {
return toString("");
@@ -579,8 +582,9 @@
* @return A string representation of this slice.
* @hide
*/
+ @NonNull
@RestrictTo(Scope.LIBRARY)
- public String toString(String indent) {
+ public String toString(@NonNull String indent) {
StringBuilder sb = new StringBuilder();
sb.append(indent);
sb.append("Slice ");
@@ -605,7 +609,7 @@
* @hide
*/
@RestrictTo(Scope.LIBRARY)
- public static void appendHints(StringBuilder sb, String[] hints) {
+ public static void appendHints(@NonNull StringBuilder sb, @Nullable String[] hints) {
if (hints == null || hints.length == 0) return;
sb.append('(');
@@ -629,8 +633,8 @@
*/
@RestrictTo(Scope.LIBRARY_GROUP_PREFIX)
@Nullable
- public static Slice bindSlice(Context context, @NonNull Uri uri,
- Set<SliceSpec> supportedSpecs) {
+ public static Slice bindSlice(@NonNull Context context, @NonNull Uri uri,
+ @Nullable Set<SliceSpec> supportedSpecs) {
if (Build.VERSION.SDK_INT >= 28) {
return callBindSlice(context, uri, supportedSpecs);
} else {
@@ -641,8 +645,9 @@
@RequiresApi(28)
private static Slice callBindSlice(Context context, Uri uri,
Set<SliceSpec> supportedSpecs) {
- return SliceConvert.wrap(context.getSystemService(SliceManager.class)
- .bindSlice(uri, unwrap(supportedSpecs)), context);
+ SliceManager sliceManager = Api23Impl.getSystemService(context, SliceManager.class);
+ return SliceConvert.wrap(Api28Impl.bindSlice(sliceManager, uri, unwrap(supportedSpecs)),
+ context);
}
/**
@@ -659,4 +664,30 @@
}
return true;
}
+
+ @RequiresApi(23)
+ static class Api23Impl {
+ private Api23Impl() {
+ // This class is not instantiable.
+ }
+
+ @DoNotInline
+ static <T> T getSystemService(Context context, Class<T> serviceClass) {
+ return context.getSystemService(serviceClass);
+ }
+
+ }
+
+ @RequiresApi(28)
+ static class Api28Impl {
+ private Api28Impl() {
+ // This class is not instantiable.
+ }
+
+ @DoNotInline
+ static android.app.slice.Slice bindSlice(SliceManager sliceManager, Uri uri,
+ Set<android.app.slice.SliceSpec> supportedSpecs) {
+ return sliceManager.bindSlice(uri, supportedSpecs);
+ }
+ }
}
diff --git a/slice/slice-remotecallback/api/restricted_current.txt b/slice/slice-remotecallback/api/restricted_current.txt
index 0be2fa03..aec2a8d 100644
--- a/slice/slice-remotecallback/api/restricted_current.txt
+++ b/slice/slice-remotecallback/api/restricted_current.txt
@@ -4,7 +4,7 @@
public abstract class RemoteSliceProvider<T extends androidx.slice.remotecallback.RemoteSliceProvider> extends androidx.slice.SliceProvider implements androidx.remotecallback.CallbackBase<T> androidx.remotecallback.CallbackReceiver<T> {
ctor public RemoteSliceProvider();
method public T createRemoteCallback(android.content.Context);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.remotecallback.RemoteCallback toRemoteCallback(Class<T!>, android.content.Context, String, android.os.Bundle, String?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.remotecallback.RemoteCallback toRemoteCallback(Class<T!>, android.content.Context, String, android.os.Bundle, String);
}
}
diff --git a/slice/slice-remotecallback/src/main/java/androidx/slice/remotecallback/RemoteSliceProvider.java b/slice/slice-remotecallback/src/main/java/androidx/slice/remotecallback/RemoteSliceProvider.java
index 64487d5..c8ca571 100644
--- a/slice/slice-remotecallback/src/main/java/androidx/slice/remotecallback/RemoteSliceProvider.java
+++ b/slice/slice-remotecallback/src/main/java/androidx/slice/remotecallback/RemoteSliceProvider.java
@@ -83,7 +83,7 @@
@Override
@RestrictTo(LIBRARY_GROUP_PREFIX)
public RemoteCallback toRemoteCallback(@NonNull Class<T> cls, @NonNull Context context,
- @NonNull String authority, @NonNull Bundle args, @Nullable String method) {
+ @NonNull String authority, @NonNull Bundle args, @NonNull String method) {
if (authority == null) {
throw new IllegalStateException(
"ContentProvider must be attached before creating callbacks");
diff --git a/slice/slice-view/src/androidTest/java/androidx/slice/widget/CachedSliceLiveDataTest.java b/slice/slice-view/src/androidTest/java/androidx/slice/widget/CachedSliceLiveDataTest.java
index e7c7ac7..b34ad92 100644
--- a/slice/slice-view/src/androidTest/java/androidx/slice/widget/CachedSliceLiveDataTest.java
+++ b/slice/slice-view/src/androidTest/java/androidx/slice/widget/CachedSliceLiveDataTest.java
@@ -78,9 +78,8 @@
private final SliceItem.ActionHandler mActionHandler = mock(SliceItem.ActionHandler.class);
private Slice mBaseSlice = new Slice.Builder(URI)
- .addAction(mActionHandler,
- new Slice.Builder(Uri.parse("content://test/something/other")).build(),
- null)
+ .addAction(new Slice.Builder(Uri.parse("content://test/something/other")).build(),
+ null, mActionHandler)
.build();
private SliceLiveData.CachedSliceLiveData mLiveData;
private ArgumentCaptor<Slice> mSlice;
@@ -210,11 +209,10 @@
@Test
public void testWaitsForLoad() throws PendingIntent.CanceledException, InterruptedException {
Slice loadingSlice = new Slice.Builder(URI)
- .addAction(mActionHandler,
- new Slice.Builder(Uri.parse("content://test/something/other"))
+ .addAction(new Slice.Builder(Uri.parse("content://test/something/other"))
.addHints(android.app.slice.Slice.HINT_PARTIAL)
.build(),
- null)
+ null, mActionHandler)
.build();
when(mManager.bindSlice(URI)).thenReturn(loadingSlice);
diff --git a/slice/slice-view/src/androidTest/java/androidx/slice/widget/SliceLiveDataTest.java b/slice/slice-view/src/androidTest/java/androidx/slice/widget/SliceLiveDataTest.java
index 6e34c93..fd48b3b 100644
--- a/slice/slice-view/src/androidTest/java/androidx/slice/widget/SliceLiveDataTest.java
+++ b/slice/slice-view/src/androidTest/java/androidx/slice/widget/SliceLiveDataTest.java
@@ -81,9 +81,8 @@
private final SliceItem.ActionHandler mActionHandler = mock(SliceItem.ActionHandler.class);
private Slice mBaseSlice = new Slice.Builder(URI)
- .addAction(mActionHandler,
- new Slice.Builder(Uri.parse("content://test/something/other")).build(),
- null)
+ .addAction(new Slice.Builder(Uri.parse("content://test/something/other")).build(),
+ null, mActionHandler)
.build();
private SliceLiveData.CachedSliceLiveData mLiveData;
private ArgumentCaptor<Slice> mSlice;
@@ -196,11 +195,10 @@
@Test
public void testWaitsForLoad() throws PendingIntent.CanceledException, InterruptedException {
Slice loadingSlice = new Slice.Builder(URI)
- .addAction(mActionHandler,
- new Slice.Builder(Uri.parse("content://test/something/other"))
+ .addAction(new Slice.Builder(Uri.parse("content://test/something/other"))
.addHints(android.app.slice.Slice.HINT_PARTIAL)
.build(),
- null)
+ null, mActionHandler)
.build();
when(mManager.bindSlice(URI)).thenReturn(loadingSlice);
diff --git a/slice/slice-view/src/main/java/androidx/slice/SliceXml.java b/slice/slice-view/src/main/java/androidx/slice/SliceXml.java
index 55043fe..3c085d6 100644
--- a/slice/slice-view/src/main/java/androidx/slice/SliceXml.java
+++ b/slice/slice-view/src/main/java/androidx/slice/SliceXml.java
@@ -204,12 +204,13 @@
} else if (type == START_TAG && TAG_SLICE.equals(parser.getName())) {
b.addSubSlice(parseSlice(context, parser, listener), subtype);
} else if (type == START_TAG && TAG_ACTION.equals(parser.getName())) {
- b.addAction(new SliceItem.ActionHandler() {
- @Override
- public void onAction(SliceItem item, Context context, Intent intent) {
- listener.onSliceAction(item.getSlice().getUri(), context, intent);
- }
- }, parseSlice(context, parser, listener), subtype);
+ b.addAction(parseSlice(context, parser, listener), subtype,
+ new SliceItem.ActionHandler() {
+ @Override
+ public void onAction(SliceItem item, Context context, Intent intent) {
+ listener.onSliceAction(item.getSlice().getUri(), context, intent);
+ }
+ });
}
}
}
diff --git a/swiperefreshlayout/swiperefreshlayout/api/current.txt b/swiperefreshlayout/swiperefreshlayout/api/current.txt
index b591080..7b9ec5e 100644
--- a/swiperefreshlayout/swiperefreshlayout/api/current.txt
+++ b/swiperefreshlayout/swiperefreshlayout/api/current.txt
@@ -41,21 +41,21 @@
ctor public SwipeRefreshLayout(android.content.Context);
ctor public SwipeRefreshLayout(android.content.Context, android.util.AttributeSet?);
method public boolean canChildScrollUp();
- method public boolean dispatchNestedPreScroll(int, int, int[]!, int[]!, int);
+ method public boolean dispatchNestedPreScroll(int, int, int[]?, int[]?, int);
method public void dispatchNestedScroll(int, int, int, int, int[]?, int, int[]);
- method public boolean dispatchNestedScroll(int, int, int, int, int[]!, int);
+ method public boolean dispatchNestedScroll(int, int, int, int, int[]?, int);
method public int getProgressCircleDiameter();
method public int getProgressViewEndOffset();
method public int getProgressViewStartOffset();
method public boolean hasNestedScrollingParent(int);
method public boolean isRefreshing();
method public void onMeasure(int, int);
- method public void onNestedPreScroll(android.view.View!, int, int, int[]!, int);
+ method public void onNestedPreScroll(android.view.View, int, int, int[], int);
method public void onNestedScroll(android.view.View, int, int, int, int, int, int[]);
- method public void onNestedScroll(android.view.View!, int, int, int, int, int);
- method public void onNestedScrollAccepted(android.view.View!, android.view.View!, int, int);
- method public boolean onStartNestedScroll(android.view.View!, android.view.View!, int, int);
- method public void onStopNestedScroll(android.view.View!, int);
+ method public void onNestedScroll(android.view.View, int, int, int, int, int);
+ method public void onNestedScrollAccepted(android.view.View, android.view.View, int, int);
+ method public boolean onStartNestedScroll(android.view.View, android.view.View, int, int);
+ method public void onStopNestedScroll(android.view.View, int);
method @Deprecated public void setColorScheme(@ColorRes int...);
method public void setColorSchemeColors(@ColorInt int...);
method public void setColorSchemeResources(@ColorRes int...);
diff --git a/swiperefreshlayout/swiperefreshlayout/api/public_plus_experimental_current.txt b/swiperefreshlayout/swiperefreshlayout/api/public_plus_experimental_current.txt
index b591080..7b9ec5e 100644
--- a/swiperefreshlayout/swiperefreshlayout/api/public_plus_experimental_current.txt
+++ b/swiperefreshlayout/swiperefreshlayout/api/public_plus_experimental_current.txt
@@ -41,21 +41,21 @@
ctor public SwipeRefreshLayout(android.content.Context);
ctor public SwipeRefreshLayout(android.content.Context, android.util.AttributeSet?);
method public boolean canChildScrollUp();
- method public boolean dispatchNestedPreScroll(int, int, int[]!, int[]!, int);
+ method public boolean dispatchNestedPreScroll(int, int, int[]?, int[]?, int);
method public void dispatchNestedScroll(int, int, int, int, int[]?, int, int[]);
- method public boolean dispatchNestedScroll(int, int, int, int, int[]!, int);
+ method public boolean dispatchNestedScroll(int, int, int, int, int[]?, int);
method public int getProgressCircleDiameter();
method public int getProgressViewEndOffset();
method public int getProgressViewStartOffset();
method public boolean hasNestedScrollingParent(int);
method public boolean isRefreshing();
method public void onMeasure(int, int);
- method public void onNestedPreScroll(android.view.View!, int, int, int[]!, int);
+ method public void onNestedPreScroll(android.view.View, int, int, int[], int);
method public void onNestedScroll(android.view.View, int, int, int, int, int, int[]);
- method public void onNestedScroll(android.view.View!, int, int, int, int, int);
- method public void onNestedScrollAccepted(android.view.View!, android.view.View!, int, int);
- method public boolean onStartNestedScroll(android.view.View!, android.view.View!, int, int);
- method public void onStopNestedScroll(android.view.View!, int);
+ method public void onNestedScroll(android.view.View, int, int, int, int, int);
+ method public void onNestedScrollAccepted(android.view.View, android.view.View, int, int);
+ method public boolean onStartNestedScroll(android.view.View, android.view.View, int, int);
+ method public void onStopNestedScroll(android.view.View, int);
method @Deprecated public void setColorScheme(@ColorRes int...);
method public void setColorSchemeColors(@ColorInt int...);
method public void setColorSchemeResources(@ColorRes int...);
diff --git a/swiperefreshlayout/swiperefreshlayout/api/restricted_current.txt b/swiperefreshlayout/swiperefreshlayout/api/restricted_current.txt
index d6e23d4..a3d3f15 100644
--- a/swiperefreshlayout/swiperefreshlayout/api/restricted_current.txt
+++ b/swiperefreshlayout/swiperefreshlayout/api/restricted_current.txt
@@ -44,21 +44,21 @@
ctor public SwipeRefreshLayout(android.content.Context);
ctor public SwipeRefreshLayout(android.content.Context, android.util.AttributeSet?);
method public boolean canChildScrollUp();
- method public boolean dispatchNestedPreScroll(int, int, int[]!, int[]!, int);
+ method public boolean dispatchNestedPreScroll(int, int, int[]?, int[]?, int);
method public void dispatchNestedScroll(int, int, int, int, int[]?, @androidx.core.view.ViewCompat.NestedScrollType int, int[]);
- method public boolean dispatchNestedScroll(int, int, int, int, int[]!, int);
+ method public boolean dispatchNestedScroll(int, int, int, int, int[]?, int);
method public int getProgressCircleDiameter();
method public int getProgressViewEndOffset();
method public int getProgressViewStartOffset();
method public boolean hasNestedScrollingParent(int);
method public boolean isRefreshing();
method public void onMeasure(int, int);
- method public void onNestedPreScroll(android.view.View!, int, int, int[]!, int);
+ method public void onNestedPreScroll(android.view.View, int, int, int[], int);
method public void onNestedScroll(android.view.View, int, int, int, int, @androidx.core.view.ViewCompat.NestedScrollType int, int[]);
- method public void onNestedScroll(android.view.View!, int, int, int, int, int);
- method public void onNestedScrollAccepted(android.view.View!, android.view.View!, int, int);
- method public boolean onStartNestedScroll(android.view.View!, android.view.View!, int, int);
- method public void onStopNestedScroll(android.view.View!, int);
+ method public void onNestedScroll(android.view.View, int, int, int, int, int);
+ method public void onNestedScrollAccepted(android.view.View, android.view.View, int, int);
+ method public boolean onStartNestedScroll(android.view.View, android.view.View, int, int);
+ method public void onStopNestedScroll(android.view.View, int);
method @Deprecated public void setColorScheme(@ColorRes int...);
method public void setColorSchemeColors(@ColorInt int...);
method public void setColorSchemeResources(@ColorRes int...);
diff --git a/swiperefreshlayout/swiperefreshlayout/src/main/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayout.java b/swiperefreshlayout/swiperefreshlayout/src/main/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayout.java
index 2afe58b..56dbe57 100644
--- a/swiperefreshlayout/swiperefreshlayout/src/main/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayout.java
+++ b/swiperefreshlayout/swiperefreshlayout/src/main/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayout.java
@@ -287,7 +287,7 @@
}
@Override
- protected Parcelable onSaveInstanceState() {
+ protected @NonNull Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
return new SavedState(superState, mRefreshing);
}
@@ -631,7 +631,7 @@
*
* @param colorResIds
*/
- public void setColorSchemeResources(@ColorRes int... colorResIds) {
+ public void setColorSchemeResources(@NonNull @ColorRes int... colorResIds) {
final Context context = getContext();
int[] colorRes = new int[colorResIds.length];
for (int i = 0; i < colorResIds.length; i++) {
@@ -647,7 +647,7 @@
*
* @param colors
*/
- public void setColorSchemeColors(@ColorInt int... colors) {
+ public void setColorSchemeColors(@NonNull @ColorInt int... colors) {
ensureTarget();
mProgress.setColorSchemeColors(colors);
}
@@ -915,7 +915,8 @@
// NestedScrollingParent 2
@Override
- public boolean onStartNestedScroll(View child, View target, int axes, int type) {
+ public boolean onStartNestedScroll(@NonNull View child, @NonNull View target, int axes,
+ int type) {
if (type == ViewCompat.TYPE_TOUCH) {
return onStartNestedScroll(child, target, axes);
} else {
@@ -924,7 +925,8 @@
}
@Override
- public void onNestedScrollAccepted(View child, View target, int axes, int type) {
+ public void onNestedScrollAccepted(@NonNull View child, @NonNull View target, int axes,
+ int type) {
// Should always be true because onStartNestedScroll returns false for all type !=
// ViewCompat.TYPE_TOUCH, but check just in case.
if (type == ViewCompat.TYPE_TOUCH) {
@@ -933,7 +935,7 @@
}
@Override
- public void onStopNestedScroll(View target, int type) {
+ public void onStopNestedScroll(@NonNull View target, int type) {
// Should always be true because onStartNestedScroll returns false for all type !=
// ViewCompat.TYPE_TOUCH, but check just in case.
if (type == ViewCompat.TYPE_TOUCH) {
@@ -942,14 +944,15 @@
}
@Override
- public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed,
- int dyUnconsumed, int type) {
+ public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed,
+ int dxUnconsumed, int dyUnconsumed, int type) {
onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type,
mNestedScrollingV2ConsumedCompat);
}
@Override
- public void onNestedPreScroll(View target, int dx, int dy, int[] consumed, int type) {
+ public void onNestedPreScroll(@NonNull View target, int dx, int dy, @NonNull int[] consumed,
+ int type) {
// Should always be true because onStartNestedScroll returns false for all type !=
// ViewCompat.TYPE_TOUCH, but check just in case.
if (type == ViewCompat.TYPE_TOUCH) {
@@ -1083,14 +1086,14 @@
@Override
public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed,
- int dyUnconsumed, int[] offsetInWindow, int type) {
+ int dyUnconsumed, @Nullable int[] offsetInWindow, int type) {
return type == ViewCompat.TYPE_TOUCH && mNestedScrollingChildHelper.dispatchNestedScroll(
dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow, type);
}
@Override
- public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow,
- int type) {
+ public boolean dispatchNestedPreScroll(int dx, int dy, @Nullable int[] consumed,
+ @Nullable int[] offsetInWindow, int type) {
return type == ViewCompat.TYPE_TOUCH && dispatchNestedPreScroll(dx, dy, consumed,
offsetInWindow);
}
@@ -1124,13 +1127,14 @@
@Override
public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed,
- int dyUnconsumed, int[] offsetInWindow) {
+ int dyUnconsumed, @Nullable int[] offsetInWindow) {
return mNestedScrollingChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed,
dxUnconsumed, dyUnconsumed, offsetInWindow);
}
@Override
- public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) {
+ public boolean dispatchNestedPreScroll(int dx, int dy, @Nullable int[] consumed,
+ @Nullable int[] offsetInWindow) {
return mNestedScrollingChildHelper.dispatchNestedPreScroll(
dx, dy, consumed, offsetInWindow);
}
diff --git a/test/uiautomator/uiautomator/api/current.txt b/test/uiautomator/uiautomator/api/current.txt
index c6c31d3..58ac424 100644
--- a/test/uiautomator/uiautomator/api/current.txt
+++ b/test/uiautomator/uiautomator/api/current.txt
@@ -94,7 +94,7 @@
}
public enum Direction {
- method public static androidx.test.uiautomator.Direction! reverse(androidx.test.uiautomator.Direction!);
+ method public static androidx.test.uiautomator.Direction reverse(androidx.test.uiautomator.Direction);
enum_constant public static final androidx.test.uiautomator.Direction DOWN;
enum_constant public static final androidx.test.uiautomator.Direction LEFT;
enum_constant public static final androidx.test.uiautomator.Direction RIGHT;
@@ -106,7 +106,7 @@
}
public interface IAutomationSupport {
- method public void sendStatus(int, android.os.Bundle!);
+ method public void sendStatus(int, android.os.Bundle);
}
public abstract class SearchCondition<R> {
@@ -132,11 +132,11 @@
}
public class UiCollection extends androidx.test.uiautomator.UiObject {
- ctor public UiCollection(androidx.test.uiautomator.UiSelector!);
- method public androidx.test.uiautomator.UiObject! getChildByDescription(androidx.test.uiautomator.UiSelector!, String!) throws androidx.test.uiautomator.UiObjectNotFoundException;
- method public androidx.test.uiautomator.UiObject! getChildByInstance(androidx.test.uiautomator.UiSelector!, int) throws androidx.test.uiautomator.UiObjectNotFoundException;
- method public androidx.test.uiautomator.UiObject! getChildByText(androidx.test.uiautomator.UiSelector!, String!) throws androidx.test.uiautomator.UiObjectNotFoundException;
- method public int getChildCount(androidx.test.uiautomator.UiSelector!);
+ ctor public UiCollection(androidx.test.uiautomator.UiSelector);
+ method public androidx.test.uiautomator.UiObject getChildByDescription(androidx.test.uiautomator.UiSelector, String) throws androidx.test.uiautomator.UiObjectNotFoundException;
+ method public androidx.test.uiautomator.UiObject getChildByInstance(androidx.test.uiautomator.UiSelector, int) throws androidx.test.uiautomator.UiObjectNotFoundException;
+ method public androidx.test.uiautomator.UiObject getChildByText(androidx.test.uiautomator.UiSelector, String) throws androidx.test.uiautomator.UiObjectNotFoundException;
+ method public int getChildCount(androidx.test.uiautomator.UiSelector);
}
public class UiDevice {
@@ -314,9 +314,9 @@
}
public class UiObjectNotFoundException extends java.lang.Exception {
- ctor public UiObjectNotFoundException(String!);
- ctor public UiObjectNotFoundException(String!, Throwable!);
- ctor public UiObjectNotFoundException(Throwable!);
+ ctor public UiObjectNotFoundException(String);
+ ctor public UiObjectNotFoundException(String, Throwable?);
+ ctor public UiObjectNotFoundException(Throwable?);
}
public class UiScrollable extends androidx.test.uiautomator.UiCollection {
diff --git a/test/uiautomator/uiautomator/api/public_plus_experimental_current.txt b/test/uiautomator/uiautomator/api/public_plus_experimental_current.txt
index c6c31d3..58ac424 100644
--- a/test/uiautomator/uiautomator/api/public_plus_experimental_current.txt
+++ b/test/uiautomator/uiautomator/api/public_plus_experimental_current.txt
@@ -94,7 +94,7 @@
}
public enum Direction {
- method public static androidx.test.uiautomator.Direction! reverse(androidx.test.uiautomator.Direction!);
+ method public static androidx.test.uiautomator.Direction reverse(androidx.test.uiautomator.Direction);
enum_constant public static final androidx.test.uiautomator.Direction DOWN;
enum_constant public static final androidx.test.uiautomator.Direction LEFT;
enum_constant public static final androidx.test.uiautomator.Direction RIGHT;
@@ -106,7 +106,7 @@
}
public interface IAutomationSupport {
- method public void sendStatus(int, android.os.Bundle!);
+ method public void sendStatus(int, android.os.Bundle);
}
public abstract class SearchCondition<R> {
@@ -132,11 +132,11 @@
}
public class UiCollection extends androidx.test.uiautomator.UiObject {
- ctor public UiCollection(androidx.test.uiautomator.UiSelector!);
- method public androidx.test.uiautomator.UiObject! getChildByDescription(androidx.test.uiautomator.UiSelector!, String!) throws androidx.test.uiautomator.UiObjectNotFoundException;
- method public androidx.test.uiautomator.UiObject! getChildByInstance(androidx.test.uiautomator.UiSelector!, int) throws androidx.test.uiautomator.UiObjectNotFoundException;
- method public androidx.test.uiautomator.UiObject! getChildByText(androidx.test.uiautomator.UiSelector!, String!) throws androidx.test.uiautomator.UiObjectNotFoundException;
- method public int getChildCount(androidx.test.uiautomator.UiSelector!);
+ ctor public UiCollection(androidx.test.uiautomator.UiSelector);
+ method public androidx.test.uiautomator.UiObject getChildByDescription(androidx.test.uiautomator.UiSelector, String) throws androidx.test.uiautomator.UiObjectNotFoundException;
+ method public androidx.test.uiautomator.UiObject getChildByInstance(androidx.test.uiautomator.UiSelector, int) throws androidx.test.uiautomator.UiObjectNotFoundException;
+ method public androidx.test.uiautomator.UiObject getChildByText(androidx.test.uiautomator.UiSelector, String) throws androidx.test.uiautomator.UiObjectNotFoundException;
+ method public int getChildCount(androidx.test.uiautomator.UiSelector);
}
public class UiDevice {
@@ -314,9 +314,9 @@
}
public class UiObjectNotFoundException extends java.lang.Exception {
- ctor public UiObjectNotFoundException(String!);
- ctor public UiObjectNotFoundException(String!, Throwable!);
- ctor public UiObjectNotFoundException(Throwable!);
+ ctor public UiObjectNotFoundException(String);
+ ctor public UiObjectNotFoundException(String, Throwable?);
+ ctor public UiObjectNotFoundException(Throwable?);
}
public class UiScrollable extends androidx.test.uiautomator.UiCollection {
diff --git a/test/uiautomator/uiautomator/api/restricted_current.txt b/test/uiautomator/uiautomator/api/restricted_current.txt
index c6c31d3..58ac424 100644
--- a/test/uiautomator/uiautomator/api/restricted_current.txt
+++ b/test/uiautomator/uiautomator/api/restricted_current.txt
@@ -94,7 +94,7 @@
}
public enum Direction {
- method public static androidx.test.uiautomator.Direction! reverse(androidx.test.uiautomator.Direction!);
+ method public static androidx.test.uiautomator.Direction reverse(androidx.test.uiautomator.Direction);
enum_constant public static final androidx.test.uiautomator.Direction DOWN;
enum_constant public static final androidx.test.uiautomator.Direction LEFT;
enum_constant public static final androidx.test.uiautomator.Direction RIGHT;
@@ -106,7 +106,7 @@
}
public interface IAutomationSupport {
- method public void sendStatus(int, android.os.Bundle!);
+ method public void sendStatus(int, android.os.Bundle);
}
public abstract class SearchCondition<R> {
@@ -132,11 +132,11 @@
}
public class UiCollection extends androidx.test.uiautomator.UiObject {
- ctor public UiCollection(androidx.test.uiautomator.UiSelector!);
- method public androidx.test.uiautomator.UiObject! getChildByDescription(androidx.test.uiautomator.UiSelector!, String!) throws androidx.test.uiautomator.UiObjectNotFoundException;
- method public androidx.test.uiautomator.UiObject! getChildByInstance(androidx.test.uiautomator.UiSelector!, int) throws androidx.test.uiautomator.UiObjectNotFoundException;
- method public androidx.test.uiautomator.UiObject! getChildByText(androidx.test.uiautomator.UiSelector!, String!) throws androidx.test.uiautomator.UiObjectNotFoundException;
- method public int getChildCount(androidx.test.uiautomator.UiSelector!);
+ ctor public UiCollection(androidx.test.uiautomator.UiSelector);
+ method public androidx.test.uiautomator.UiObject getChildByDescription(androidx.test.uiautomator.UiSelector, String) throws androidx.test.uiautomator.UiObjectNotFoundException;
+ method public androidx.test.uiautomator.UiObject getChildByInstance(androidx.test.uiautomator.UiSelector, int) throws androidx.test.uiautomator.UiObjectNotFoundException;
+ method public androidx.test.uiautomator.UiObject getChildByText(androidx.test.uiautomator.UiSelector, String) throws androidx.test.uiautomator.UiObjectNotFoundException;
+ method public int getChildCount(androidx.test.uiautomator.UiSelector);
}
public class UiDevice {
@@ -314,9 +314,9 @@
}
public class UiObjectNotFoundException extends java.lang.Exception {
- ctor public UiObjectNotFoundException(String!);
- ctor public UiObjectNotFoundException(String!, Throwable!);
- ctor public UiObjectNotFoundException(Throwable!);
+ ctor public UiObjectNotFoundException(String);
+ ctor public UiObjectNotFoundException(String, Throwable?);
+ ctor public UiObjectNotFoundException(Throwable?);
}
public class UiScrollable extends androidx.test.uiautomator.UiCollection {
diff --git a/test/uiautomator/uiautomator/build.gradle b/test/uiautomator/uiautomator/build.gradle
index 33db0f5..bf4554c 100644
--- a/test/uiautomator/uiautomator/build.gradle
+++ b/test/uiautomator/uiautomator/build.gradle
@@ -23,7 +23,7 @@
dependencies {
implementation(libs.junit)
- implementation project(path: ':annotation:annotation')
+ implementation("androidx.annotation:annotation:1.4.0")
androidTestImplementation(libs.testCore)
androidTestImplementation(libs.testRunner)
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoDumper.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoDumper.java
index 4919395..0d0c707 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoDumper.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoDumper.java
@@ -30,6 +30,7 @@
* @hide
*/
class AccessibilityNodeInfoDumper {
+ private AccessibilityNodeInfoDumper() { }
private static final String LOGTAG = AccessibilityNodeInfoDumper.class.getSimpleName();
private static final String[] NAF_EXCLUDED_CLASSES = new String[] {
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoHelper.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoHelper.java
index a03ab6c..6729da0 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoHelper.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoHelper.java
@@ -26,6 +26,8 @@
*/
class AccessibilityNodeInfoHelper {
+ private AccessibilityNodeInfoHelper() {}
+
/**
* Returns the node's bounds clipped to the size of the display
*
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/Direction.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/Direction.java
index 2b2e136..4467ef9 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/Direction.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/Direction.java
@@ -16,6 +16,8 @@
package androidx.test.uiautomator;
+import androidx.annotation.NonNull;
+
/** An enumeration used to specify the primary direction of certain gestures. */
@SuppressWarnings("ImmutableEnumChecker")
public enum Direction {
@@ -30,7 +32,8 @@
}
/** Returns the reverse of the given direction. */
- public static Direction reverse(Direction direction) {
+ @NonNull
+ public static Direction reverse(@NonNull Direction direction) {
return direction.mOpposite;
}
}
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/IAutomationSupport.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/IAutomationSupport.java
index d371c27..17d6879 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/IAutomationSupport.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/IAutomationSupport.java
@@ -18,6 +18,8 @@
import android.os.Bundle;
+import androidx.annotation.NonNull;
+
/**
* Provides auxiliary support for running test cases
*
@@ -32,6 +34,6 @@
* @param status status report, consisting of key value pairs
* @since API Level 16
*/
- public void sendStatus(int resultCode, Bundle status);
+ void sendStatus(int resultCode, @NonNull Bundle status);
}
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/InstrumentationAutomationSupport.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/InstrumentationAutomationSupport.java
index 99c6055..3390113 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/InstrumentationAutomationSupport.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/InstrumentationAutomationSupport.java
@@ -19,6 +19,8 @@
import android.app.Instrumentation;
import android.os.Bundle;
+import androidx.annotation.NonNull;
+
/**
* A wrapper around {@link Instrumentation} to provide sendStatus function
*
@@ -35,7 +37,7 @@
}
@Override
- public void sendStatus(int resultCode, Bundle status) {
+ public void sendStatus(int resultCode, @NonNull Bundle status) {
mInstrumentation.sendStatus(resultCode, status);
}
}
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiCollection.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiCollection.java
index 2ff23e6..3225209 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiCollection.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiCollection.java
@@ -16,6 +16,8 @@
package androidx.test.uiautomator;
+import androidx.annotation.NonNull;
+
/**
* Used to enumerate a container's UI elements for the purpose of counting,
* or targeting a sub elements by a child's text or description.
@@ -29,7 +31,7 @@
* @param selector
* @since API Level 16
*/
- public UiCollection(UiSelector selector) {
+ public UiCollection(@NonNull UiSelector selector) {
super(selector);
}
@@ -48,7 +50,8 @@
* @throws UiObjectNotFoundException
* @since API Level 16
*/
- public UiObject getChildByDescription(UiSelector childPattern, String text)
+ @NonNull
+ public UiObject getChildByDescription(@NonNull UiSelector childPattern, @NonNull String text)
throws UiObjectNotFoundException {
Tracer.trace(childPattern, text);
if (text != null) {
@@ -82,7 +85,8 @@
* @return {@link UiObject} pointing at and instance of <code>childPattern</code>
* @since API Level 16
*/
- public UiObject getChildByInstance(UiSelector childPattern, int instance)
+ @NonNull
+ public UiObject getChildByInstance(@NonNull UiSelector childPattern, int instance)
throws UiObjectNotFoundException {
Tracer.trace(childPattern, instance);
UiSelector patternSelector = UiSelector.patternBuilder(getSelector(),
@@ -106,7 +110,8 @@
* @throws UiObjectNotFoundException
* @since API Level 16
*/
- public UiObject getChildByText(UiSelector childPattern, String text)
+ @NonNull
+ public UiObject getChildByText(@NonNull UiSelector childPattern, @NonNull String text)
throws UiObjectNotFoundException {
Tracer.trace(childPattern, text);
if (text != null) {
@@ -137,7 +142,7 @@
* @return the number of matched childPattern under the current {@link UiCollection}
* @since API Level 16
*/
- public int getChildCount(UiSelector childPattern) {
+ public int getChildCount(@NonNull UiSelector childPattern) {
Tracer.trace(childPattern);
UiSelector patternSelector =
UiSelector.patternBuilder(getSelector(), UiSelector.patternBuilder(childPattern));
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiObjectNotFoundException.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiObjectNotFoundException.java
index 7fd1c1d6..db0c494 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiObjectNotFoundException.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiObjectNotFoundException.java
@@ -16,6 +16,9 @@
package androidx.test.uiautomator;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
/**
* Generated in test runs when a {@link UiSelector} selector could not be matched
* to any UI element displayed.
@@ -28,21 +31,21 @@
/**
* @since API Level 16
**/
- public UiObjectNotFoundException(String msg) {
+ public UiObjectNotFoundException(@NonNull String msg) {
super(msg);
}
/**
* @since API Level 16
**/
- public UiObjectNotFoundException(String detailMessage, Throwable throwable) {
+ public UiObjectNotFoundException(@NonNull String detailMessage, @Nullable Throwable throwable) {
super(detailMessage, throwable);
}
/**
* @since API Level 16
**/
- public UiObjectNotFoundException(Throwable throwable) {
+ public UiObjectNotFoundException(@Nullable Throwable throwable) {
super(throwable);
}
}
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiScrollable.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiScrollable.java
index 1391e59..72381f1 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiScrollable.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiScrollable.java
@@ -20,6 +20,8 @@
import android.util.Log;
import android.view.accessibility.AccessibilityNodeInfo;
+import androidx.annotation.NonNull;
+
/**
* UiScrollable is a {@link UiCollection} and provides support for searching
* for items in scrollable layout elements. This class can be used with
@@ -106,14 +108,16 @@
* See {@link #getChildByDescription(UiSelector, String, boolean)}
*
* @param childPattern {@link UiSelector} for a child in a scollable layout element
- * @param text Content-description to find in the children of
+ * @param text Content-description to find in the children of
* the <code>childPattern</code> match
* @return {@link UiObject} representing the child element that matches the search conditions
* @throws UiObjectNotFoundException
* @since API Level 16
*/
+ @NonNull
@Override
- public UiObject getChildByDescription(UiSelector childPattern, String text)
+ public UiObject getChildByDescription(
+ @NonNull UiSelector childPattern, @NonNull String text)
throws UiObjectNotFoundException {
Tracer.trace(childPattern, text);
return getChildByDescription(childPattern, text, true);
@@ -158,6 +162,7 @@
* @return {@link UiObject} representing the child element that matches the search conditions
* @since API Level 16
*/
+ @NonNull
@Override
public UiObject getChildByInstance(UiSelector childPattern, int instance)
throws UiObjectNotFoundException {
@@ -183,8 +188,9 @@
* @throws UiObjectNotFoundException
* @since API Level 16
*/
+ @NonNull
@Override
- public UiObject getChildByText(UiSelector childPattern, String text)
+ public UiObject getChildByText(@NonNull UiSelector childPattern, @NonNull String text)
throws UiObjectNotFoundException {
Tracer.trace(childPattern, text);
return getChildByText(childPattern, text, true);
@@ -339,7 +345,7 @@
/**
* Sets the maximum number of scrolls allowed when performing a
* scroll action in search of a child element.
- * See {@link #getChildByDescription(UiSelector, String)} and
+ * See {@link UiCollection#getChildByDescription(UiSelector, String)} and
* {@link #getChildByText(UiSelector, String)}.
*
* @param swipes the number of search swipes to perform until giving up
@@ -355,7 +361,7 @@
/**
* Gets the maximum number of scrolls allowed when performing a
* scroll action in search of a child element.
- * See {@link #getChildByDescription(UiSelector, String)} and
+ * See {@link UiCollection#getChildByDescription(UiSelector, String)} and
* {@link #getChildByText(UiSelector, String)}.
*
* @return max the number of search swipes to perform until giving up
diff --git a/transition/transition/api/restricted_current.txt b/transition/transition/api/restricted_current.txt
index 461f133..d380e52 100644
--- a/transition/transition/api/restricted_current.txt
+++ b/transition/transition/api/restricted_current.txt
@@ -80,22 +80,22 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class FragmentTransitionSupport extends androidx.fragment.app.FragmentTransitionImpl {
ctor public FragmentTransitionSupport();
- method public void addTarget(Object!, android.view.View!);
- method public void addTargets(Object!, java.util.ArrayList<android.view.View!>!);
- method public void beginDelayedTransition(android.view.ViewGroup!, Object!);
- method public boolean canHandle(Object!);
- method public Object! cloneTransition(Object!);
- method public Object! mergeTransitionsInSequence(Object!, Object!, Object!);
- method public Object! mergeTransitionsTogether(Object!, Object!, Object!);
- method public void removeTarget(Object!, android.view.View!);
- method public void replaceTargets(Object!, java.util.ArrayList<android.view.View!>!, java.util.ArrayList<android.view.View!>!);
- method public void scheduleHideFragmentView(Object!, android.view.View!, java.util.ArrayList<android.view.View!>!);
- method public void scheduleRemoveTargets(Object!, Object!, java.util.ArrayList<android.view.View!>!, Object!, java.util.ArrayList<android.view.View!>!, Object!, java.util.ArrayList<android.view.View!>!);
- method public void setEpicenter(Object!, android.view.View!);
- method public void setEpicenter(Object!, android.graphics.Rect!);
- method public void setSharedElementTargets(Object!, android.view.View!, java.util.ArrayList<android.view.View!>!);
- method public void swapSharedElementTargets(Object!, java.util.ArrayList<android.view.View!>!, java.util.ArrayList<android.view.View!>!);
- method public Object! wrapTransitionInSet(Object!);
+ method public void addTarget(Object, android.view.View);
+ method public void addTargets(Object, java.util.ArrayList<android.view.View!>);
+ method public void beginDelayedTransition(android.view.ViewGroup, Object?);
+ method public boolean canHandle(Object);
+ method public Object? cloneTransition(Object?);
+ method public Object? mergeTransitionsInSequence(Object?, Object?, Object?);
+ method public Object mergeTransitionsTogether(Object, Object, Object?);
+ method public void removeTarget(Object, android.view.View);
+ method public void replaceTargets(Object, java.util.ArrayList<android.view.View!>!, java.util.ArrayList<android.view.View!>!);
+ method public void scheduleHideFragmentView(Object, android.view.View, java.util.ArrayList<android.view.View!>);
+ method public void scheduleRemoveTargets(Object, Object?, java.util.ArrayList<android.view.View!>?, Object?, java.util.ArrayList<android.view.View!>?, Object?, java.util.ArrayList<android.view.View!>?);
+ method public void setEpicenter(Object, android.view.View);
+ method public void setEpicenter(Object, android.graphics.Rect);
+ method public void setSharedElementTargets(Object, android.view.View, java.util.ArrayList<android.view.View!>);
+ method public void swapSharedElementTargets(Object?, java.util.ArrayList<android.view.View!>?, java.util.ArrayList<android.view.View!>?);
+ method public Object? wrapTransitionInSet(Object?);
}
public abstract class PathMotion {
diff --git a/transition/transition/src/main/java/androidx/transition/FragmentTransitionSupport.java b/transition/transition/src/main/java/androidx/transition/FragmentTransitionSupport.java
index 961b1ce..07ef593 100644
--- a/transition/transition/src/main/java/androidx/transition/FragmentTransitionSupport.java
+++ b/transition/transition/src/main/java/androidx/transition/FragmentTransitionSupport.java
@@ -24,6 +24,7 @@
import android.view.ViewGroup;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.core.os.CancellationSignal;
import androidx.fragment.app.Fragment;
@@ -44,12 +45,13 @@
public class FragmentTransitionSupport extends FragmentTransitionImpl {
@Override
- public boolean canHandle(Object transition) {
+ public boolean canHandle(@NonNull Object transition) {
return transition instanceof Transition;
}
+ @Nullable
@Override
- public Object cloneTransition(Object transition) {
+ public Object cloneTransition(@Nullable Object transition) {
Transition copy = null;
if (transition != null) {
copy = ((Transition) transition).clone();
@@ -57,8 +59,9 @@
return copy;
}
+ @Nullable
@Override
- public Object wrapTransitionInSet(Object transition) {
+ public Object wrapTransitionInSet(@Nullable Object transition) {
if (transition == null) {
return null;
}
@@ -68,8 +71,8 @@
}
@Override
- public void setSharedElementTargets(Object transitionObj,
- View nonExistentView, ArrayList<View> sharedViews) {
+ public void setSharedElementTargets(@NonNull Object transitionObj,
+ @NonNull View nonExistentView, @NonNull ArrayList<View> sharedViews) {
TransitionSet transition = (TransitionSet) transitionObj;
final List<View> views = transition.getTargets();
views.clear();
@@ -84,7 +87,7 @@
}
@Override
- public void setEpicenter(Object transitionObj, View view) {
+ public void setEpicenter(@NonNull Object transitionObj, @NonNull View view) {
if (view != null) {
Transition transition = (Transition) transitionObj;
final Rect epicenter = new Rect();
@@ -100,7 +103,7 @@
}
@Override
- public void addTargets(Object transitionObj, ArrayList<View> views) {
+ public void addTargets(@NonNull Object transitionObj, @NonNull ArrayList<View> views) {
Transition transition = (Transition) transitionObj;
if (transition == null) {
return;
@@ -130,9 +133,10 @@
|| !isNullOrEmpty(transition.getTargetTypes());
}
+ @NonNull
@Override
- public Object mergeTransitionsTogether(Object transition1, Object transition2,
- Object transition3) {
+ public Object mergeTransitionsTogether(@NonNull Object transition1,
+ @NonNull Object transition2, @Nullable Object transition3) {
TransitionSet transitionSet = new TransitionSet();
if (transition1 != null) {
transitionSet.addTransition((Transition) transition1);
@@ -147,8 +151,8 @@
}
@Override
- public void scheduleHideFragmentView(Object exitTransitionObj, final View fragmentView,
- final ArrayList<View> exitingViews) {
+ public void scheduleHideFragmentView(@NonNull Object exitTransitionObj,
+ final @NonNull View fragmentView, final @NonNull ArrayList<View> exitingViews) {
Transition exitTransition = (Transition) exitTransitionObj;
exitTransition.addListener(new Transition.TransitionListener() {
@Override
@@ -187,9 +191,10 @@
});
}
+ @Nullable
@Override
- public Object mergeTransitionsInSequence(Object exitTransitionObj,
- Object enterTransitionObj, Object sharedElementTransitionObj) {
+ public Object mergeTransitionsInSequence(@Nullable Object exitTransitionObj,
+ @Nullable Object enterTransitionObj, @Nullable Object sharedElementTransitionObj) {
// First do exit, then enter, but allow shared element transition to happen
// during both.
Transition staggered = null;
@@ -219,15 +224,16 @@
}
@Override
- public void beginDelayedTransition(ViewGroup sceneRoot, Object transition) {
+ public void beginDelayedTransition(@NonNull ViewGroup sceneRoot, @Nullable Object transition) {
TransitionManager.beginDelayedTransition(sceneRoot, (Transition) transition);
}
@Override
- public void scheduleRemoveTargets(final Object overallTransitionObj,
- final Object enterTransition, final ArrayList<View> enteringViews,
- final Object exitTransition, final ArrayList<View> exitingViews,
- final Object sharedElementTransition, final ArrayList<View> sharedElementsIn) {
+ public void scheduleRemoveTargets(final @NonNull Object overallTransitionObj,
+ final @Nullable Object enterTransition, final @Nullable ArrayList<View> enteringViews,
+ final @Nullable Object exitTransition, final @Nullable ArrayList<View> exitingViews,
+ final @Nullable Object sharedElementTransition,
+ final @Nullable ArrayList<View> sharedElementsIn) {
final Transition overallTransition = (Transition) overallTransitionObj;
overallTransition.addListener(new TransitionListenerAdapter() {
@Override
@@ -292,8 +298,9 @@
}
@Override
- public void swapSharedElementTargets(Object sharedElementTransitionObj,
- ArrayList<View> sharedElementsOut, ArrayList<View> sharedElementsIn) {
+ public void swapSharedElementTargets(@Nullable Object sharedElementTransitionObj,
+ @Nullable ArrayList<View> sharedElementsOut,
+ @Nullable ArrayList<View> sharedElementsIn) {
TransitionSet sharedElementTransition = (TransitionSet) sharedElementTransitionObj;
if (sharedElementTransition != null) {
sharedElementTransition.getTargets().clear();
@@ -303,8 +310,9 @@
}
@Override
- public void replaceTargets(Object transitionObj, ArrayList<View> oldTargets,
- ArrayList<View> newTargets) {
+ public void replaceTargets(@NonNull Object transitionObj,
+ @SuppressLint("UnknownNullness") ArrayList<View> oldTargets,
+ @SuppressLint("UnknownNullness") ArrayList<View> newTargets) {
Transition transition = (Transition) transitionObj;
if (transition instanceof TransitionSet) {
TransitionSet set = (TransitionSet) transition;
@@ -330,7 +338,7 @@
}
@Override
- public void addTarget(Object transitionObj, View view) {
+ public void addTarget(@NonNull Object transitionObj, @NonNull View view) {
if (transitionObj != null) {
Transition transition = (Transition) transitionObj;
transition.addTarget(view);
@@ -338,7 +346,7 @@
}
@Override
- public void removeTarget(Object transitionObj, View view) {
+ public void removeTarget(@NonNull Object transitionObj, @NonNull View view) {
if (transitionObj != null) {
Transition transition = (Transition) transitionObj;
transition.removeTarget(view);
@@ -346,7 +354,7 @@
}
@Override
- public void setEpicenter(Object transitionObj, final Rect epicenter) {
+ public void setEpicenter(@NonNull Object transitionObj, final @NonNull Rect epicenter) {
if (transitionObj != null) {
Transition transition = (Transition) transitionObj;
transition.setEpicenterCallback(new Transition.EpicenterCallback() {
diff --git a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/BaseTest.kt b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/BaseTest.kt
index 12bc64d..a81994e 100644
--- a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/BaseTest.kt
+++ b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/BaseTest.kt
@@ -75,6 +75,7 @@
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import kotlin.math.abs
+import org.junit.Assert.fail
open class BaseTest {
companion object {
@@ -734,7 +735,11 @@
if (i < n - 1) {
Log.w(BaseTest.TAG, "Bad state, retrying block", e)
} else {
- throw AssertionError("Block hit bad state $n times", e)
+ val errorMessage = "Block hit bad state $n times"
+ when {
+ Build.VERSION.SDK_INT >= 19 -> throw AssertionError(errorMessage, e)
+ else -> fail(errorMessage)
+ }
}
resetBlock()
}
diff --git a/wear/wear-ongoing/src/test/java/androidx/wear/ongoing/OngoingActivityTest.kt b/wear/wear-ongoing/src/test/java/androidx/wear/ongoing/OngoingActivityTest.kt
index 6a960c9..91f80752 100644
--- a/wear/wear-ongoing/src/test/java/androidx/wear/ongoing/OngoingActivityTest.kt
+++ b/wear/wear-ongoing/src/test/java/androidx/wear/ongoing/OngoingActivityTest.kt
@@ -6,6 +6,7 @@
import android.content.Intent
import android.os.Build
import android.os.Bundle
+import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import androidx.core.content.LocusIdCompat
import androidx.test.core.app.ApplicationProvider
@@ -22,6 +23,7 @@
@RunWith(PatchedRobolectricTestRunner::class)
@DoNotInstrument
@Config(sdk = [Build.VERSION_CODES.Q])
+@RequiresApi(Build.VERSION_CODES.Q) // Lint doesn't understand @Config b/236744544
open class OngoingActivityTest {
private val AnimatedIconResourceId = 123
private val StaticIconResourceId = 456
diff --git a/wear/wear/api/current.txt b/wear/wear/api/current.txt
index 65a6853..8c2d6d1 100644
--- a/wear/wear/api/current.txt
+++ b/wear/wear/api/current.txt
@@ -311,7 +311,7 @@
method public void setAlpha(int);
method public void setBackgroundColor(@ColorInt int);
method public void setClipEnabled(boolean);
- method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(android.graphics.ColorFilter?);
method public void setDrawable(android.graphics.drawable.Drawable?);
method public void setRadius(int);
}
diff --git a/wear/wear/api/public_plus_experimental_current.txt b/wear/wear/api/public_plus_experimental_current.txt
index 65a6853..8c2d6d1 100644
--- a/wear/wear/api/public_plus_experimental_current.txt
+++ b/wear/wear/api/public_plus_experimental_current.txt
@@ -311,7 +311,7 @@
method public void setAlpha(int);
method public void setBackgroundColor(@ColorInt int);
method public void setClipEnabled(boolean);
- method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(android.graphics.ColorFilter?);
method public void setDrawable(android.graphics.drawable.Drawable?);
method public void setRadius(int);
}
diff --git a/wear/wear/api/restricted_current.txt b/wear/wear/api/restricted_current.txt
index 9fa9f23..036a3961 100644
--- a/wear/wear/api/restricted_current.txt
+++ b/wear/wear/api/restricted_current.txt
@@ -318,7 +318,7 @@
method public void setAlpha(int);
method public void setBackgroundColor(@ColorInt int);
method public void setClipEnabled(boolean);
- method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(android.graphics.ColorFilter?);
method public void setDrawable(android.graphics.drawable.Drawable?);
method public void setRadius(int);
}
diff --git a/wear/wear/src/main/java/androidx/wear/widget/RoundedDrawable.java b/wear/wear/src/main/java/androidx/wear/widget/RoundedDrawable.java
index bb23167..7d0cb94 100644
--- a/wear/wear/src/main/java/androidx/wear/widget/RoundedDrawable.java
+++ b/wear/wear/src/main/java/androidx/wear/widget/RoundedDrawable.java
@@ -245,7 +245,7 @@
}
@Override
- public void setColorFilter(ColorFilter cf) {
+ public void setColorFilter(@Nullable ColorFilter cf) {
mPaint.setColorFilter(cf);
}
diff --git a/webkit/OWNERS b/webkit/OWNERS
index b275a9b..3852064 100644
--- a/webkit/OWNERS
+++ b/webkit/OWNERS
@@ -1,3 +1,5 @@
# Bug component: 461230
[email protected]
[email protected]
[email protected]
[email protected]