Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ internal class ImageArchive {
}

/**
* Creates ImageArchive from either SdCard or Internet. SdCard is used only when the build
* is debuggable and the file actually exists.
* Creates ImageArchive from either SdCard or Internet. SdCard is used only when the
* file actually exists.
*/
fun getDefault(): ImageArchive {
val archive = fromSdCard()
return if (Build.isDebuggable() && archive.exists()) {
return if (archive.exists()) {
archive
} else {
fromInternet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class InstallerActivity : BaseActivity() {

setContentView(R.layout.activity_installer)
updateSizeEstimation(ESTIMATED_IMG_SIZE_BYTES)
sdcardLocation(fromSdCard().getPath())
measureImageSizeAndUpdateDescription()

waitForWifiCheckbox = findViewById<CheckBox>(R.id.installer_wait_for_wifi_checkbox)
Expand All @@ -75,6 +76,15 @@ public class InstallerActivity : BaseActivity() {
}
}

private fun sdcardLocation(dst: String) {
val desc =
getString(R.string.installer_sdcard_info_text_format, dst)
runOnUiThread {
val view = findViewById<TextView>(R.id.installer_sdcard_info)
view.text = desc
}
}

private fun updateSizeEstimation(est: Long) {
val desc =
getString(R.string.installer_desc_text_format, Formatter.formatShortFileSize(this, est))
Expand All @@ -101,7 +111,7 @@ public class InstallerActivity : BaseActivity() {
override fun onResume() {
super.onResume()

if (Build.isDebuggable() && fromSdCard().exists()) {
if (fromSdCard().exists()) {
showSnackBar("Auto installing", Snackbar.LENGTH_LONG)
requestInstall()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ class InstallerService : Service() {
val archive = fromSdCard()
val archive_path = archive.getPath()

// Installing from sdcard is preferred, but only supported only in debuggable build.
if (!Build.isDebuggable()) {
Log.i(TAG, "Non-debuggable build doesn't support installation from $archive_path")
return false
}
if (!archive.exists()) {
return false
}
Expand Down
11 changes: 11 additions & 0 deletions android/TerminalApp/res/layout/activity_installer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@
android:layout_marginHorizontal="32dp"
android:textSize="16sp" />

<TextView
android:id="@+id/installer_sdcard_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_below="@id/installer_desc"
android:lineSpacingExtra="5dp"
android:layout_marginTop="24dp"
android:layout_marginHorizontal="32dp"
android:textSize="16sp" />

<CheckBox
android:id="@+id/installer_wait_for_wifi_checkbox"
android:layout_width="wrap_content"
Expand Down
2 changes: 2 additions & 0 deletions android/TerminalApp/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
<string name="installer_title_text">Install Linux terminal</string>
<!-- Installer activity description format [CHAR LIMIT=none] -->
<string name="installer_desc_text_format">To launch Linux terminal, you need to download roughly <xliff:g id="expected_size" example="350GB">\u200E%1$s\u200E</xliff:g> of data over the network.\nWould you like to proceed?</string>
<!-- Installer activity extra description [CHAR LIMIT=none] -->
<string name="installer_sdcard_info_text_format">Alternatively, if you want to provide your own custom image, you can place it under <xliff:g id="sdcard_loc">%1$s</xliff:g> using adb or the Files app</string>
<!-- Checkbox at the installer activity to download when Wi-Fi is available to prevent from paying network traffic [CHAR LIMIT=none] -->
<string name="installer_wait_for_wifi_checkbox_text">Download using Wi-Fi only</string>
<!-- Button at the installer activity to confirm installation [CHAR LIMIT=16] -->
Expand Down