Skip to content

Commit c7f248d

Browse files
committed
Keep the chosen server across the activity's restart, make Continue the one action while the field is open, and picture the status bar before the app starts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012xYtaUjbkB1hwLtK4TEzhq
1 parent 7ae471a commit c7f248d

4 files changed

Lines changed: 22 additions & 7 deletions

File tree

‎android-shell/app/src/main/java/ai/openbot/shell/ShellActivity.kt‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class ShellActivity : AppCompatActivity() {
8888
}
8989

9090
override fun onCreate(savedInstanceState: Bundle?) {
91-
config = ShellConfig.from(this, intent)
91+
config = ShellConfig.from(this, intent, fresh = savedInstanceState == null)
9292
DebugHooks.beforeCreate(this, config.hooks)
9393
super.onCreate(savedInstanceState)
9494
enableEdgeToEdge()
@@ -212,7 +212,7 @@ class ShellActivity : AppCompatActivity() {
212212
for (quiet in listOf(serverHost, selfHostedToggle, lockHost, lockChange, findViewById<TextView>(R.id.self_hosted_cancel))) {
213213
quiet.setTextColor(secondary)
214214
}
215-
for (button in listOf(signInButton, findViewById<MaterialButton>(R.id.retry_button))) {
215+
for (button in listOf(signInButton, addressContinue, findViewById<MaterialButton>(R.id.retry_button))) {
216216
button.backgroundTintList = ColorStateList.valueOf(ink)
217217
button.setTextColor(paper)
218218
}
@@ -401,7 +401,8 @@ class ShellActivity : AppCompatActivity() {
401401
selfHostedToggle.text = getString(if (config.selfHosted) R.string.self_hosted_use_cloud else R.string.self_hosted_toggle)
402402
serverHost.isVisible = config.selfHosted && !launching && !serverPanelOpen
403403
serverHost.text = getString(R.string.self_hosted_signs_in_to, config.displayHost)
404-
signInButton.isVisible = !launching && !(controller.pickingServer && serverPanelOpen)
404+
// While the field is open its Continue is the one action; Sign in (OpenBot Cloud) steps back.
405+
signInButton.isVisible = !launching && !serverPanelOpen
405406
addressContinue.isEnabled = !checkingServer
406407
addressContinue.text = getString(if (checkingServer) R.string.self_hosted_checking else R.string.self_hosted_continue)
407408
addressInput.isEnabled = !checkingServer

‎android-shell/app/src/main/java/ai/openbot/shell/ShellConfig.kt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class ShellConfig(
6565
fun isOwnOrigin(url: String?): Boolean = Origins.same(url, origin)
6666

6767
companion object {
68-
fun from(context: android.content.Context, intent: Intent?): ShellConfig {
68+
/** `fresh`: a new launch (not a restart of the activity, which keeps its launch intent). */
69+
fun from(context: android.content.Context, intent: Intent?, fresh: Boolean = true): ShellConfig {
6970
var baseOverride: String? = null
7071
var diagnostics = false
7172
var testName = ""
@@ -76,7 +77,7 @@ class ShellConfig(
7677
testName = overrides.testName
7778
}
7879
val hooks = DebugHooks.read(intent)
79-
if (hooks.reset) ServerChoice.clear(context)
80+
if (hooks.reset && fresh) ServerChoice.clear(context)
8081
val cloud = resolveBase(baseOverride)
8182
val chosen = if (hooks.plainWebView) null else ServerChoice.saved(context)
8283
return ShellConfig(

‎android-shell/app/src/main/res/layout/sign_in_screen.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@
189189

190190
<com.google.android.material.button.MaterialButton
191191
android:id="@+id/self_hosted_continue"
192-
style="@style/Widget.Material3.Button.OutlinedButton"
193192
android:layout_width="wrap_content"
194193
android:layout_height="wrap_content"
195-
android:minHeight="48dp"
194+
android:minHeight="52dp"
195+
android:paddingHorizontal="28dp"
196196
android:text="@string/self_hosted_continue"
197197
app:cornerRadius="12dp" />
198198
</LinearLayout>

‎android-shell/ci/emulator.sh‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ describe() {
105105
echo "SCREEN=$(adb shell wm size | tr -d '\r' | tail -n1) $(adb shell wm density | tr -d '\r' | tail -n1)"
106106
} | tee "$ARTIFACTS/device.env"
107107
adb shell pm list packages | tr -d '\r' | grep -i -E 'chrome|webview|browser|inputmethod' || true
108+
# The status bar before any app of ours runs (some runs draw it with its icons cut off): the
109+
# launcher's picture and what the window manager and SurfaceFlinger report.
110+
adb shell input keyevent KEYCODE_HOME > /dev/null 2>&1 || true
111+
sleep 3
112+
adb exec-out screencap -p > "$ARTIFACTS/launcher-before-app.png" 2>/dev/null || true
113+
{
114+
echo "== dumpsys window windows (StatusBar)"
115+
adb shell dumpsys window windows | tr -d '\r' | grep -i -A8 'StatusBar' | head -n 40
116+
echo "== SurfaceFlinger layers"
117+
adb shell dumpsys SurfaceFlinger --list | tr -d '\r' | head -n 60
118+
echo "== cpu and memory"
119+
nproc; free -m | head -n 2; uptime
120+
} > "$ARTIFACTS/status-bar-before-app.txt" 2>&1 || true
108121
}
109122

110123
case "${1:-all}" in

0 commit comments

Comments
 (0)