App 2.19.2: Full screen for CarPlay (experiment)
Adds com.allgo.carplay.service to immersive.full in Android 9's policy_control setting when switched on, removes only that entry when off. Car build (system user) only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.evsuite.abrp;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/** The policy_control value the CarPlay full-screen switch writes — pure JVM. */
|
||||
public class PolicyControlTest {
|
||||
|
||||
private static final String CP = "com.allgo.carplay.service";
|
||||
|
||||
@Test
|
||||
public void unsetGainsOnlyOurEntryAndLosesItAgain() {
|
||||
String on = PolicyControl.withFull(null, CP);
|
||||
assertEquals("immersive.full=" + CP, on);
|
||||
assertTrue(PolicyControl.hasFull(on, CP));
|
||||
assertNull(PolicyControl.withoutFull(on, CP));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void otherEntriesSurviveOnAndOff() {
|
||||
String before = "immersive.status=com.a:immersive.full=com.b";
|
||||
String on = PolicyControl.withFull(before, CP);
|
||||
assertEquals("immersive.status=com.a:immersive.full=com.b," + CP, on);
|
||||
assertEquals(before, PolicyControl.withoutFull(on, CP));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addingTwiceAddsOnce() {
|
||||
String once = PolicyControl.withFull(null, CP);
|
||||
assertEquals(once, PolicyControl.withFull(once, CP));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onlyAnExactPackageCounts() {
|
||||
assertFalse(PolicyControl.hasFull("immersive.full=" + CP + ".other", CP));
|
||||
assertFalse(PolicyControl.hasFull("immersive.status=" + CP, CP));
|
||||
assertFalse(PolicyControl.hasFull(null, CP));
|
||||
assertFalse(PolicyControl.hasFull("", CP));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removingWhatIsNotThereKeepsTheRest() {
|
||||
assertEquals("immersive.status=com.a", PolicyControl.withoutFull("immersive.status=com.a", CP));
|
||||
assertNull(PolicyControl.withoutFull(null, CP));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user