Merge "Fix FocusSearchNavigationTest on API 15."
diff --git a/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV14.java b/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV14.java
index 7ab3047..631fc35 100644
--- a/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV14.java
+++ b/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV14.java
@@ -231,7 +231,7 @@
return true;
} else {
if (DEBUG) {
- Log.d(TAG, "applyNightMode() | Skipping. Night mode has not changed: " + mode);
+ Log.d(TAG, "applyNightMode() | Night mode has not changed. Skipping");
}
}
return false;
@@ -321,7 +321,6 @@
@ApplyableNightMode
final int getApplyableNightMode() {
- mIsNight = mTwilightManager.isNight();
return mIsNight ? MODE_NIGHT_YES : MODE_NIGHT_NO;
}
@@ -337,7 +336,7 @@
cleanup();
// If we're set to AUTO, we register a receiver to be notified on time changes. The
- // system only sends the tick out every minute, but that's enough fidelity for our use
+ // system only send the tick out every minute, but that's enough fidelity for our use
// case
if (mAutoTimeChangeReceiver == null) {
mAutoTimeChangeReceiver = new BroadcastReceiver() {
diff --git a/v7/appcompat/tests/src/android/support/v7/app/NightModeTestCase.java b/v7/appcompat/tests/src/android/support/v7/app/NightModeTestCase.java
index 157631c..a9c8dc2 100644
--- a/v7/appcompat/tests/src/android/support/v7/app/NightModeTestCase.java
+++ b/v7/appcompat/tests/src/android/support/v7/app/NightModeTestCase.java
@@ -17,7 +17,6 @@
package android.support.v7.app;
import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
@@ -27,14 +26,11 @@
import static org.junit.Assert.assertFalse;
import android.app.Instrumentation;
-import android.content.Intent;
-import android.os.SystemClock;
import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.MediumTest;
import android.support.test.filters.SdkSuppress;
import android.support.test.filters.Suppress;
import android.support.v7.appcompat.test.R;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.view.KeyEvent;
import org.junit.Before;
import org.junit.Test;
@@ -127,36 +123,6 @@
onView(withId(R.id.text_night_mode)).check(matches(withText(STRING_NIGHT)));
}
- @Test
- public void testNightModeAutoRecreatesOnResume() throws Throwable {
- // Create a fake TwilightManager and set it as the app instance
- final FakeTwilightManager twilightManager = new FakeTwilightManager();
- TwilightManager.setInstance(twilightManager);
-
- final NightModeActivity activity = getActivity();
-
- // Set MODE_NIGHT_AUTO so that we will change to night mode automatically
- setLocalNightModeAndWaitForRecreate(activity, AppCompatDelegate.MODE_NIGHT_AUTO);
- // Verify that we're currently in day mode
- onView(withId(R.id.text_night_mode)).check(matches(withText(STRING_DAY)));
-
- // Now start another Activity so that the original one goes into the background, then
- // wait a short time for everything to settle down
- final Intent intent = new Intent(activity, AppCompatActivity.class);
- activity.startActivity(intent);
- onView(withId(R.id.text_night_mode)).check(doesNotExist());
- SystemClock.sleep(400);
-
- // Now update the fake twilight manager to be in night
- twilightManager.setIsNight(true);
-
- // Now press back, so that the original Activity is brought back into the foreground
- getInstrumentation().sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
-
- // Now check that the text has changed, signifying that night resources are being used
- onView(withId(R.id.text_night_mode)).check(matches(withText(STRING_NIGHT)));
- }
-
private static class FakeTwilightManager extends TwilightManager {
private boolean mIsNight;