feat: polish Pakkit and strengthen release readiness
- Improve Wear splash, ongoing status, and progress focus - Refine browser accessibility and connection recovery - Add offline privacy and open-source notices - Harden installation approval and storage error handling - Expand emulator coverage and release artifact checks - Document Play publication gates and hardware validation
This commit is contained in:
34 files changed
+1027
-111
No files matched your search
@@ -27,7 +27,7 @@ The current artifacts are development builds. Public distribution requires the c
|
|||||||
| `scripts` | Emulator-only test runner and ADB helpers |
|
| `scripts` | Emulator-only test runner and ADB helpers |
|
||||||
| `docs` | Architecture, design, development, platform, privacy and release guidance |
|
| `docs` | Architecture, design, development, platform, privacy and release guidance |
|
||||||
|
|
||||||
There is one production module and one test-fixture module. Production has one explicit library dependency: ZXing Core for local QR generation. Kotlin’s standard library is supplied by the Android Gradle plugin.
|
There is one production module and one test-fixture module. Production uses ZXing Core for local QR generation, AndroidX Wear Ongoing for receiving status, and AndroidX Core/SplashScreen for platform notifications and Wear launch sizing. Kotlin’s standard library is supplied by the Android Gradle plugin. Bundled privacy text and open-source acknowledgements are available from the application.
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
@@ -55,4 +55,4 @@ python3 scripts/test-emulators.py --watch emulator-5554 --small --skip-build
|
|||||||
|
|
||||||
For browser tests and real Android-Emulator-to-Wear-Emulator uploads, see [development and testing](docs/DEVELOPMENT.md). Results and screenshots are generated under `app/build/reports/validation`, not checked into source control.
|
For browser tests and real Android-Emulator-to-Wear-Emulator uploads, see [development and testing](docs/DEVELOPMENT.md). Results and screenshots are generated under `app/build/reports/validation`, not checked into source control.
|
||||||
|
|
||||||
[Restriction audit](docs/RESTRICTIONS.md) · [Architecture](docs/ARCHITECTURE.md) · [Design](docs/DESIGN.md) · [Platform](docs/PLATFORM.md) · [Privacy](docs/PRIVACY.md) · [Release](docs/RELEASE.md) · [Validation](docs/VALIDATION.md)
|
[Product review](docs/PRODUCT_REVIEW.md) · [Store listing draft](docs/STORE_LISTING.md) · [Restriction audit](docs/RESTRICTIONS.md) · [Architecture](docs/ARCHITECTURE.md) · [Design](docs/DESIGN.md) · [Platform](docs/PLATFORM.md) · [Privacy](docs/PRIVACY.md) · [Release](docs/RELEASE.md) · [Validation](docs/VALIDATION.md)
|
||||||
@@ -43,6 +43,9 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(libs.zxing)
|
implementation(libs.zxing)
|
||||||
|
implementation(libs.androidx.core)
|
||||||
|
implementation(libs.wear.ongoing)
|
||||||
|
implementation(libs.splashscreen)
|
||||||
testImplementation(libs.junit)
|
testImplementation(libs.junit)
|
||||||
androidTestImplementation(libs.androidx.junit)
|
androidTestImplementation(libs.androidx.junit)
|
||||||
androidTestImplementation(libs.androidx.runner)
|
androidTestImplementation(libs.androidx.runner)
|
||||||
|
|||||||
@@ -14,6 +14,68 @@ import org.junit.runner.RunWith
|
|||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class InstallSafetyTest : WatchTest() {
|
class InstallSafetyTest : WatchTest() {
|
||||||
|
@Test
|
||||||
|
fun watchActionAndSystemConfirmationCompleteInstallation() {
|
||||||
|
assumeTrue(context.packageManager.canRequestPackageInstalls())
|
||||||
|
val apk = fixture()
|
||||||
|
store.stage(apk)
|
||||||
|
openWatch()
|
||||||
|
instrumentation.runOnMainSync {
|
||||||
|
fun views(view: android.view.View): List<android.view.View> =
|
||||||
|
listOf(view) +
|
||||||
|
if (view is android.view.ViewGroup)
|
||||||
|
(0 until view.childCount).flatMap { views(view.getChildAt(it)) }
|
||||||
|
else emptyList()
|
||||||
|
views(requireNotNull(activity).window.decorView)
|
||||||
|
.filterIsInstance<android.widget.Button>()
|
||||||
|
.single { it.text == "Install" }
|
||||||
|
.performClick()
|
||||||
|
}
|
||||||
|
await(15_000) { store.pending()?.state == InstallState.CONFIRM }
|
||||||
|
// Exercise the real system button. No shell install or source-permission grant.
|
||||||
|
var consentClicked = false
|
||||||
|
try {
|
||||||
|
await(15_000) {
|
||||||
|
if (consentClicked) return@await true
|
||||||
|
val root = instrumentation.uiAutomation.rootInActiveWindow
|
||||||
|
val button =
|
||||||
|
root
|
||||||
|
?.let { node ->
|
||||||
|
listOf("Install", "Update").flatMap {
|
||||||
|
node.findAccessibilityNodeInfosByText(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?.firstOrNull {
|
||||||
|
it.text?.toString() in setOf("Install", "Update") &&
|
||||||
|
it.isClickable &&
|
||||||
|
it.isEnabled &&
|
||||||
|
it.packageName?.toString() != context.packageName
|
||||||
|
}
|
||||||
|
consentClicked =
|
||||||
|
button?.performAction(
|
||||||
|
android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK
|
||||||
|
) == true
|
||||||
|
consentClicked
|
||||||
|
}
|
||||||
|
} catch (failure: Exception) {
|
||||||
|
fun labels(node: android.view.accessibility.AccessibilityNodeInfo): List<String> =
|
||||||
|
listOf(
|
||||||
|
"${node.packageName}: ${node.text} / ${node.contentDescription} clickable=${node.isClickable}"
|
||||||
|
) +
|
||||||
|
(0 until node.childCount).flatMap {
|
||||||
|
node.getChild(it)?.let(::labels) ?: emptyList()
|
||||||
|
}
|
||||||
|
println(instrumentation.uiAutomation.rootInActiveWindow?.let(::labels))
|
||||||
|
throw failure
|
||||||
|
}
|
||||||
|
await(30_000) {
|
||||||
|
store.pending()?.state in setOf(InstallState.INSTALLED, InstallState.FAILED)
|
||||||
|
}
|
||||||
|
assertEquals(store.pending()?.detail, InstallState.INSTALLED, store.pending()?.state)
|
||||||
|
assertFalse(store.file(apk.id).exists())
|
||||||
|
assertNull(PendingApproval.intent)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun receiptAndForgedCallbacksCannotMarkPackageInstalled() {
|
fun receiptAndForgedCallbacksCannotMarkPackageInstalled() {
|
||||||
val apk = fixture()
|
val apk = fixture()
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ class PackageStoreTest : WatchTest() {
|
|||||||
}
|
}
|
||||||
return written
|
return written
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun remove(key: String): android.content.SharedPreferences.Editor {
|
||||||
|
editor.remove(key)
|
||||||
|
return this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,11 +50,15 @@ class PackageStoreTest : WatchTest() {
|
|||||||
}
|
}
|
||||||
assertTrue(
|
assertTrue(
|
||||||
runCatching {
|
runCatching {
|
||||||
PackageStore(wrapped).update(apk.id, InstallState.INSTALLING, "Preparing")
|
PackageStore(wrapped).update(apk.id, InstallState.INSTALLING, "Preparing")
|
||||||
}
|
}
|
||||||
.isFailure
|
.isFailure
|
||||||
)
|
)
|
||||||
assertEquals(apk, store.pending())
|
assertEquals(apk, store.pending())
|
||||||
|
failNext = true
|
||||||
|
assertTrue(runCatching { PackageStore(wrapped).dismiss(apk.id) }.isFailure)
|
||||||
|
assertEquals(apk, store.pending())
|
||||||
|
assertTrue("Failed removal keeps the original APK", store.file(apk.id).exists())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -11,6 +11,53 @@ import org.junit.runner.RunWith
|
|||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class ReceiverLifecycleTest : WatchTest() {
|
class ReceiverLifecycleTest : WatchTest() {
|
||||||
|
@Test
|
||||||
|
fun ongoingActivityReflectsReviewAndStopActionEndsReceiving() {
|
||||||
|
val permission = android.Manifest.permission.POST_NOTIFICATIONS
|
||||||
|
val granted =
|
||||||
|
context.checkSelfPermission(permission) ==
|
||||||
|
android.content.pm.PackageManager.PERMISSION_GRANTED
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= 33 && !granted)
|
||||||
|
instrumentation.uiAutomation.grantRuntimePermission(context.packageName, permission)
|
||||||
|
// Keep this optional notification grant on the disposable emulator. Revoking a
|
||||||
|
// runtime permission kills the target process and its instrumentation runner.
|
||||||
|
run {
|
||||||
|
openWatch()
|
||||||
|
context.startForegroundService(
|
||||||
|
android.content.Intent(context, meghdad.pakkit.transfer.ReceiveService::class.java)
|
||||||
|
)
|
||||||
|
await(30_000) { meghdad.pakkit.transfer.Receiving.state.url != null }
|
||||||
|
val manager = context.getSystemService(android.app.NotificationManager::class.java)
|
||||||
|
await { androidx.wear.ongoing.OngoingActivity.recoverOngoingActivity(context) != null }
|
||||||
|
val ongoing =
|
||||||
|
requireNotNull(
|
||||||
|
androidx.wear.ongoing.OngoingActivity.recoverOngoingActivity(context)
|
||||||
|
)
|
||||||
|
assertTrue(ongoing.touchIntent.isImmutable)
|
||||||
|
store.stage(fixture())
|
||||||
|
try {
|
||||||
|
await {
|
||||||
|
manager.activeNotifications.any {
|
||||||
|
it.id == ongoing.notificationId &&
|
||||||
|
it.notification.extras.getString(
|
||||||
|
android.app.Notification.EXTRA_TITLE
|
||||||
|
) == "Ready to install"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (failure: Exception) {
|
||||||
|
throw AssertionError(
|
||||||
|
"Notifications: ${manager.activeNotifications.map { it.id to it.notification.extras.getString(android.app.Notification.EXTRA_TITLE) }}; review=${store.pending()?.state}; receiving=${meghdad.pakkit.transfer.Receiving.state}",
|
||||||
|
failure,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val notification =
|
||||||
|
manager.activeNotifications.single { it.id == ongoing.notificationId }.notification
|
||||||
|
notification.actions.single { it.title == "Stop receiving" }.actionIntent.send()
|
||||||
|
await { !meghdad.pakkit.transfer.Receiving.state.active }
|
||||||
|
await { manager.activeNotifications.none { it.id == ongoing.notificationId } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun ipv6ListenerAcceptsCanonicalBrowserAuthority() {
|
fun ipv6ListenerAcceptsCanonicalBrowserAuthority() {
|
||||||
LocalHttpServer(context, InetAddress.getByName("::1"), Any()).use { server ->
|
LocalHttpServer(context, InetAddress.getByName("::1"), Any()).use { server ->
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ class WatchExperienceTest : WatchTest() {
|
|||||||
private fun screen() = views(requireNotNull(activity).window.decorView)
|
private fun screen() = views(requireNotNull(activity).window.decorView)
|
||||||
|
|
||||||
private fun capture(name: String) {
|
private fun capture(name: String) {
|
||||||
|
await {
|
||||||
|
var focused = false
|
||||||
|
instrumentation.runOnMainSync { focused = activity?.hasWindowFocus() == true }
|
||||||
|
focused
|
||||||
|
}
|
||||||
instrumentation.waitForIdleSync()
|
instrumentation.waitForIdleSync()
|
||||||
Thread.sleep(220) // Finite screen entrance; screenshots capture the settled UI.
|
Thread.sleep(220) // Finite screen entrance; screenshots capture the settled UI.
|
||||||
val bitmap = requireNotNull(instrumentation.uiAutomation.takeScreenshot())
|
val bitmap = requireNotNull(instrumentation.uiAutomation.takeScreenshot())
|
||||||
@@ -56,6 +61,83 @@ class WatchExperienceTest : WatchTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun privacyIsAvailableWithoutStartingReceiving() {
|
||||||
|
openWatch()
|
||||||
|
val monitor =
|
||||||
|
instrumentation.addMonitor(
|
||||||
|
meghdad.pakkit.ui.AboutActivity::class.java.name,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
instrumentation.runOnMainSync {
|
||||||
|
screen().filterIsInstance<Button>().single { it.text == "Privacy" }.performClick()
|
||||||
|
}
|
||||||
|
activity = requireNotNull(monitor.waitForActivityWithTimeout(5000))
|
||||||
|
instrumentation.removeMonitor(monitor)
|
||||||
|
instrumentation.waitForIdleSync()
|
||||||
|
instrumentation.runOnMainSync {
|
||||||
|
assertTrue(
|
||||||
|
screen().filterIsInstance<TextView>().any { it.text.contains("without encryption") }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
assertFalse(Receiving.state.active)
|
||||||
|
assertActionsReachable()
|
||||||
|
capture("privacy")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun uploadProgressKeepsFocusAndViewIdentity() {
|
||||||
|
val owner = Any()
|
||||||
|
try {
|
||||||
|
Receiving.begin(owner)
|
||||||
|
Receiving.update(owner) {
|
||||||
|
it.copy(
|
||||||
|
url = "http://10.0.2.16:8787/",
|
||||||
|
total = Long.MAX_VALUE,
|
||||||
|
received = Long.MAX_VALUE / 2,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
openWatch()
|
||||||
|
val original = screen().filterIsInstance<RoundScrollView>().single()
|
||||||
|
instrumentation.runOnMainSync {
|
||||||
|
screen()
|
||||||
|
.filterIsInstance<Button>()
|
||||||
|
.single { it.text == "Stop receiving" }
|
||||||
|
.requestFocus()
|
||||||
|
}
|
||||||
|
val focused = requireNotNull(activity).currentFocus
|
||||||
|
Receiving.update(owner) { it.copy(received = Long.MAX_VALUE) }
|
||||||
|
instrumentation.waitForIdleSync()
|
||||||
|
instrumentation.runOnMainSync {
|
||||||
|
assertSame(original, screen().filterIsInstance<RoundScrollView>().single())
|
||||||
|
assertSame(focused, requireNotNull(activity).currentFocus)
|
||||||
|
assertTrue(screen().filterIsInstance<TextView>().any { it.text == "100%" })
|
||||||
|
assertTrue(
|
||||||
|
screen().filterIsInstance<TextView>().any { it.text == "Just checking…" }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
Receiving.end(owner, "Receiving stopped")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun externalActivityExtrasCannotSupplyAnInstallerIntent() {
|
||||||
|
val apk = fixture()
|
||||||
|
store.stage(apk.copy(state = InstallState.CONFIRM, sessionId = 123))
|
||||||
|
val intent =
|
||||||
|
android.content
|
||||||
|
.Intent(context, WatchActivity::class.java)
|
||||||
|
.putExtra("job", apk.id)
|
||||||
|
.putExtra("approval", android.content.Intent("untrusted.action"))
|
||||||
|
.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
|
context.startActivity(intent)
|
||||||
|
instrumentation.waitForIdleSync()
|
||||||
|
assertNull(meghdad.pakkit.install.PendingApproval.intent)
|
||||||
|
openWatch()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun homeLeadsWithBrandAndReceiving() {
|
fun homeLeadsWithBrandAndReceiving() {
|
||||||
openWatch()
|
openWatch()
|
||||||
|
|||||||
@@ -23,12 +23,14 @@
|
|||||||
android:name=".ui.WatchActivity"
|
android:name=".ui.WatchActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@style/Theme.Pakkit.Starting"
|
||||||
android:taskAffinity="">
|
android:taskAffinity="">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name=".ui.AboutActivity" android:exported="false" android:taskAffinity="" />
|
||||||
<service
|
<service
|
||||||
android:name=".transfer.ReceiveService"
|
android:name=".transfer.ReceiveService"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
|||||||
@@ -0,0 +1,216 @@
|
|||||||
|
Pakkit — Open-source acknowledgements
|
||||||
|
|
||||||
|
Pakkit includes ZXing (ZXing Authors), AndroidX (The Android Open Source Project), Kotlin and kotlinx.coroutines (JetBrains and contributors), JetBrains annotations, JSpecify and Guava ListenableFuture (Google and contributors).
|
||||||
|
|
||||||
|
These libraries are distributed under the Apache License, Version 2.0, reproduced below. Their original copyright notices are retained in the distributed library metadata where supplied.
|
||||||
|
|
||||||
|
Projects:
|
||||||
|
https://github.com/zxing/zxing
|
||||||
|
https://android.googlesource.com/platform/frameworks/support/
|
||||||
|
https://github.com/JetBrains/kotlin
|
||||||
|
https://github.com/Kotlin/kotlinx.coroutines
|
||||||
|
https://github.com/JetBrains/java-annotations
|
||||||
|
https://github.com/jspecify/jspecify
|
||||||
|
https://github.com/google/guava
|
||||||
|
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ZXing release source NOTICE
|
||||||
|
|
||||||
|
The upstream project-wide notice is reproduced below; it is not an additional runtime dependency list.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
NOTICES FOR BARCODE4J
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Barcode4J
|
||||||
|
Copyright 2002-2010 Jeremias Märki
|
||||||
|
Copyright 2005-2006 Dietmar Bürkle
|
||||||
|
|
||||||
|
Portions of this software were contributed under section 5 of the
|
||||||
|
Apache License. Contributors are listed under:
|
||||||
|
http://barcode4j.sourceforge.net/contributors.html
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
NOTICES FOR JCOMMANDER
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright 2010 Cedric Beust cedric@beust.com
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
Pakkit — Privacy
|
||||||
|
|
||||||
|
Pakkit sends the APK you choose directly from your browser to your Wear OS watch over Wi-Fi. There are no accounts, analytics, ads, cloud storage or remote services in Pakkit.
|
||||||
|
|
||||||
|
Your connection
|
||||||
|
|
||||||
|
Your watch asks before allowing a browser to connect. Access ends when you stop receiving or Pakkit’s process ends. Your browser remembers a random access credential in storage for this watch address. You can remove it using your browser’s site settings. An old credential cannot reopen a stopped session. Browser and device names are hints from the browser; your watch also shows the network address.
|
||||||
|
|
||||||
|
Use Wi-Fi you trust. Files and access credentials travel without encryption. Someone with access to your network traffic could read or alter them. Browser approval does not encrypt the connection.
|
||||||
|
|
||||||
|
Your files
|
||||||
|
|
||||||
|
APKs and their package details are saved in private watch storage. Pakkit checks package information and a file fingerprint before installation; it does not certify that an app is safe. Installation always requires your action and Android’s approval. Android may perform its own checks.
|
||||||
|
|
||||||
|
Rejected and interrupted uploads are removed. A received file stays until you remove it, replace a failed review, or finish installation. Files left by an interrupted process are removed when Pakkit next starts. Backups of Pakkit’s private files are disabled. Uninstalling Pakkit removes its private files; apps you installed are separate.
|
||||||
|
|
||||||
|
Receiving continues until you stop it or your watch ends it. Losing Wi-Fi interrupts a transfer, and receiving resumes when Wi-Fi returns. Stopping receiving does not cancel an installation already handed to Android.
|
||||||
@@ -14,11 +14,20 @@ function accessHeaders() {
|
|||||||
} catch {}
|
} catch {}
|
||||||
return credential ? { Authorization: 'Bearer ' + credential } : {};
|
return credential ? { Authorization: 'Bearer ' + credential } : {};
|
||||||
}
|
}
|
||||||
|
let savedTheme;
|
||||||
|
try {
|
||||||
|
savedTheme = localStorage.getItem('pakkitTheme');
|
||||||
|
} catch {}
|
||||||
const initialTheme = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
const initialTheme = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
||||||
document.documentElement.dataset.theme = initialTheme;
|
document.documentElement.dataset.theme = ['light', 'dark'].includes(savedTheme)
|
||||||
|
? savedTheme
|
||||||
|
: initialTheme;
|
||||||
$('theme').onclick = () => {
|
$('theme').onclick = () => {
|
||||||
document.documentElement.dataset.theme =
|
document.documentElement.dataset.theme =
|
||||||
document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';
|
document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';
|
||||||
|
try {
|
||||||
|
localStorage.setItem('pakkitTheme', document.documentElement.dataset.theme);
|
||||||
|
} catch {}
|
||||||
};
|
};
|
||||||
function setText(id, value) {
|
function setText(id, value) {
|
||||||
if ($(id).textContent !== value) $(id).textContent = value;
|
if ($(id).textContent !== value) $(id).textContent = value;
|
||||||
@@ -27,6 +36,8 @@ function message(text = '') {
|
|||||||
setText('message', text);
|
setText('message', text);
|
||||||
}
|
}
|
||||||
function panel(id) {
|
function panel(id) {
|
||||||
|
const active = document.activeElement;
|
||||||
|
const moveFocus = active && active !== document.body && active.closest('[data-panel]')?.id !== id;
|
||||||
const step = id === 'progress-panel' ? 1 : id === 'result' ? 2 : 0;
|
const step = id === 'progress-panel' ? 1 : id === 'result' ? 2 : 0;
|
||||||
document.querySelectorAll('.steps li').forEach((item, index) => {
|
document.querySelectorAll('.steps li').forEach((item, index) => {
|
||||||
if (index === step) item.setAttribute('aria-current', 'step');
|
if (index === step) item.setAttribute('aria-current', 'step');
|
||||||
@@ -37,6 +48,14 @@ function panel(id) {
|
|||||||
['pairing', 'dropzone', 'selection', 'progress-panel', 'result'].forEach(
|
['pairing', 'dropzone', 'selection', 'progress-panel', 'result'].forEach(
|
||||||
(key) => ($(key).hidden = key !== id),
|
(key) => ($(key).hidden = key !== id),
|
||||||
);
|
);
|
||||||
|
// Move keyboard focus only when its control disappears. Polling must never steal it.
|
||||||
|
if (moveFocus && active.closest('[data-panel]')) {
|
||||||
|
const destination = $(id).querySelector('h3, button:not([disabled]), strong');
|
||||||
|
if (destination) {
|
||||||
|
destination.tabIndex = destination.matches('button') ? 0 : -1;
|
||||||
|
destination.focus({ preventScroll: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function selected(next) {
|
function selected(next) {
|
||||||
if (!online || pending || upload) return;
|
if (!online || pending || upload) return;
|
||||||
@@ -82,13 +101,16 @@ zone.addEventListener('drop', (e) => {
|
|||||||
});
|
});
|
||||||
window.addEventListener('dragover', (e) => e.preventDefault());
|
window.addEventListener('dragover', (e) => e.preventDefault());
|
||||||
window.addEventListener('drop', (e) => e.preventDefault());
|
window.addEventListener('drop', (e) => e.preventDefault());
|
||||||
function result(title, detail, success = false) {
|
function result(title, detail, state = 'ready') {
|
||||||
panel('result');
|
panel('result');
|
||||||
setText('result-title', title);
|
setText('result-title', title);
|
||||||
setText('result-detail', detail);
|
setText('result-detail', detail);
|
||||||
$('result-icon').textContent = success ? '✓' : '↗';
|
setText(
|
||||||
$('result').dataset.state = success ? 'success' : 'waiting';
|
'result-icon',
|
||||||
$('again').hidden = true;
|
state === 'installed' || state === 'waiting' ? '✓' : state === 'failed' ? '!' : '↗',
|
||||||
|
);
|
||||||
|
if ($('result').dataset.state !== state) $('result').dataset.state = state;
|
||||||
|
$('again').hidden = !['installed', 'failed', 'waiting'].includes(state);
|
||||||
}
|
}
|
||||||
$('send').onclick = () => {
|
$('send').onclick = () => {
|
||||||
if (!file || !online || upload) return;
|
if (!file || !online || upload) return;
|
||||||
@@ -182,13 +204,25 @@ function pairing(state) {
|
|||||||
);
|
);
|
||||||
$('retry-connection').hidden = state !== 'denied';
|
$('retry-connection').hidden = state !== 'denied';
|
||||||
}
|
}
|
||||||
|
async function request(path, options = {}) {
|
||||||
|
const controller = new AbortController();
|
||||||
|
const timeout = setTimeout(() => controller.abort(), 5000);
|
||||||
|
try {
|
||||||
|
const response = await fetch(path, { ...options, signal: controller.signal });
|
||||||
|
// Keep the probe bounded until its small status body arrives as well as headers.
|
||||||
|
const data = await response.json();
|
||||||
|
return { ok: response.ok, status: response.status, data };
|
||||||
|
} finally {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
async function connect(retry = false) {
|
async function connect(retry = false) {
|
||||||
const response = await fetch(retry ? '/api/retry' : '/api/connect', {
|
const response = await request(retry ? '/api/retry' : '/api/connect', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: accessHeaders(),
|
headers: accessHeaders(),
|
||||||
});
|
});
|
||||||
if (!response.ok) throw new Error('disconnected');
|
if (!response.ok) throw new Error('disconnected');
|
||||||
const data = await response.json();
|
const data = response.data;
|
||||||
if (data.credential) {
|
if (data.credential) {
|
||||||
credential = data.credential;
|
credential = data.credential;
|
||||||
try {
|
try {
|
||||||
@@ -205,19 +239,18 @@ async function poll() {
|
|||||||
if (polling) return;
|
if (polling) return;
|
||||||
polling = true;
|
polling = true;
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/api/status', {
|
const response = await request('/api/status', {
|
||||||
headers: accessHeaders(),
|
headers: accessHeaders(),
|
||||||
cache: 'no-store',
|
cache: 'no-store',
|
||||||
signal: AbortSignal.timeout ? AbortSignal.timeout(5000) : undefined,
|
|
||||||
});
|
});
|
||||||
if (response.status === 403) {
|
if (response.status === 403) {
|
||||||
const data = await response.json();
|
const data = response.data;
|
||||||
if (data.connection === 'unknown') await connect();
|
if (data.connection === 'unknown') await connect();
|
||||||
else pairing(data.connection);
|
else pairing(data.connection);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!response.ok) throw new Error('disconnected');
|
if (!response.ok) throw new Error('disconnected');
|
||||||
const data = await response.json();
|
const data = response.data;
|
||||||
if (!online) {
|
if (!online) {
|
||||||
message();
|
message();
|
||||||
if (!pending && !upload) panel(file ? 'selection' : 'dropzone');
|
if (!pending && !upload) panel(file ? 'selection' : 'dropzone');
|
||||||
@@ -240,14 +273,10 @@ async function poll() {
|
|||||||
failed: ['Let’s try that again', data.detail],
|
failed: ['Let’s try that again', data.detail],
|
||||||
};
|
};
|
||||||
const content = states[data.state] || ['Check your watch.', data.detail];
|
const content = states[data.state] || ['Check your watch.', data.detail];
|
||||||
result(content[0], content[1], data.state === 'installed');
|
result(content[0], content[1], data.state);
|
||||||
$('result').dataset.state = data.state;
|
|
||||||
if (['installed', 'failed'].includes(data.state)) $('again').hidden = false;
|
|
||||||
if (data.state === 'failed') $('result-icon').textContent = '!';
|
|
||||||
} else if (pending) {
|
} else if (pending) {
|
||||||
((pending = false), (choosingNext = false));
|
((pending = false), (choosingNext = false));
|
||||||
result('Ready for another?', 'Your watch is ready to receive a new app.', true);
|
result('Ready for another?', 'Your watch is ready to receive a new app.', 'waiting');
|
||||||
$('again').hidden = false;
|
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
online = false;
|
online = false;
|
||||||
|
|||||||
@@ -145,7 +145,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<h2 id="card-title">Good things<br />come in Pakkits.</h2>
|
<h2 id="card-title">Good things<br />come in Pakkits.</h2>
|
||||||
<p class="card-description">Choose an app for your watch. We’ll deliver it.</p>
|
<p class="card-description">Choose an app for your watch. We’ll deliver it.</p>
|
||||||
<div id="pairing" role="status" aria-live="polite">
|
<noscript><p>Turn on JavaScript in your browser to send apps to your watch.</p></noscript>
|
||||||
|
<div id="pairing" data-panel role="status" aria-live="polite">
|
||||||
<div class="pairing-symbol" aria-hidden="true">↗</div>
|
<div class="pairing-symbol" aria-hidden="true">↗</div>
|
||||||
<h3 id="pairing-title">A quick hello</h3>
|
<h3 id="pairing-title">A quick hello</h3>
|
||||||
<p id="pairing-detail">Tap Allow browser on your watch.</p>
|
<p id="pairing-detail">Tap Allow browser on your watch.</p>
|
||||||
@@ -156,7 +157,7 @@
|
|||||||
<li>Send</li>
|
<li>Send</li>
|
||||||
<li>Wear</li>
|
<li>Wear</li>
|
||||||
</ol>
|
</ol>
|
||||||
<div id="dropzone" class="dropzone">
|
<div id="dropzone" data-panel class="dropzone">
|
||||||
<div class="upload-symbol" aria-hidden="true">↑</div>
|
<div class="upload-symbol" aria-hidden="true">↑</div>
|
||||||
<strong>A little app. A new possibility.</strong
|
<strong>A little app. A new possibility.</strong
|
||||||
><span>Drop an APK here to get started.</span
|
><span>Drop an APK here to get started.</span
|
||||||
@@ -169,7 +170,7 @@
|
|||||||
hidden
|
hidden
|
||||||
/><small>APK files · sent directly to your watch</small>
|
/><small>APK files · sent directly to your watch</small>
|
||||||
</div>
|
</div>
|
||||||
<div id="selection" hidden>
|
<div id="selection" data-panel hidden>
|
||||||
<div class="file-row">
|
<div class="file-row">
|
||||||
<div class="file-icon" aria-hidden="true">◇</div>
|
<div class="file-icon" aria-hidden="true">◇</div>
|
||||||
<div><strong id="filename"></strong><small id="filesize"></small></div>
|
<div><strong id="filename"></strong><small id="filesize"></small></div>
|
||||||
@@ -179,7 +180,7 @@
|
|||||||
Send to watch <span aria-hidden="true">→</span>
|
Send to watch <span aria-hidden="true">→</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="progress-panel" hidden>
|
<div id="progress-panel" data-panel hidden>
|
||||||
<div class="progress-heading">
|
<div class="progress-heading">
|
||||||
<strong id="progress-title">On its way</strong><span id="percentage">0%</span>
|
<strong id="progress-title">On its way</strong><span id="percentage">0%</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -187,7 +188,7 @@
|
|||||||
<p id="progress-detail">Keep this page open. Your app is on its way.</p>
|
<p id="progress-detail">Keep this page open. Your app is on its way.</p>
|
||||||
<button id="cancel" class="secondary" type="button">Cancel transfer</button>
|
<button id="cancel" class="secondary" type="button">Cancel transfer</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="result" role="status" aria-live="polite" aria-atomic="true" hidden>
|
<div id="result" data-panel role="status" aria-live="polite" aria-atomic="true" hidden>
|
||||||
<div id="result-icon" aria-hidden="true">✓</div>
|
<div id="result-icon" aria-hidden="true">✓</div>
|
||||||
<h3 id="result-title">Made it to your watch</h3>
|
<h3 id="result-title">Made it to your watch</h3>
|
||||||
<p id="result-detail">Tap Install on your watch when you’re ready.</p>
|
<p id="result-detail">Tap Install on your watch when you’re ready.</p>
|
||||||
@@ -213,6 +214,10 @@
|
|||||||
</p>
|
</p>
|
||||||
</details>
|
</details>
|
||||||
</span>
|
</span>
|
||||||
|
<span class="legal-links"
|
||||||
|
><a href="/privacy.txt" target="_blank" rel="noopener">Privacy</a
|
||||||
|
><a href="/licenses.txt" target="_blank" rel="noopener">Open-source licenses</a></span
|
||||||
|
>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -890,3 +890,14 @@ small {
|
|||||||
background: #9e82ff12;
|
background: #9e82ff12;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.legal-links {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.legal-links a {
|
||||||
|
color: var(--muted);
|
||||||
|
text-underline-offset: 4px;
|
||||||
|
min-height: 24px;
|
||||||
|
}
|
||||||
@@ -47,8 +47,13 @@ class PackageStore(context: Context) {
|
|||||||
fun dismiss(id: String) =
|
fun dismiss(id: String) =
|
||||||
synchronized(lock) {
|
synchronized(lock) {
|
||||||
if (pending()?.id != id) return@synchronized
|
if (pending()?.id != id) return@synchronized
|
||||||
|
val previous = preferences.getString(PENDING_KEY, null)
|
||||||
|
if (!preferences.edit().remove(PENDING_KEY).commit()) {
|
||||||
|
if (!preferences.edit().putString(PENDING_KEY, previous).commit())
|
||||||
|
android.util.Log.w("PakkitStore", "Could not persist removal rollback")
|
||||||
|
throw UserMessage("Couldn’t remove this app. Try again.")
|
||||||
|
}
|
||||||
file(id).delete()
|
file(id).delete()
|
||||||
check(preferences.edit().remove(PENDING_KEY).commit())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called at process startup, before any transfer can own an uncommitted file. */
|
/** Called at process startup, before any transfer can own an uncommitted file. */
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class InstallReceiver : BroadcastReceiver() {
|
|||||||
val apk = PackageStore(context).pending() ?: return
|
val apk = PackageStore(context).pending() ?: return
|
||||||
if (apk.state != InstallState.CONFIRM || PendingApproval.id != apk.id) return
|
if (apk.state != InstallState.CONFIRM || PendingApproval.id != apk.id) return
|
||||||
val sessionId = apk.sessionId ?: return
|
val sessionId = apk.sessionId ?: return
|
||||||
val confirmation = PendingApproval.intent ?: return
|
if (PendingApproval.intent == null) return
|
||||||
val manager = context.getSystemService(NotificationManager::class.java)
|
val manager = context.getSystemService(NotificationManager::class.java)
|
||||||
manager.createNotificationChannel(
|
manager.createNotificationChannel(
|
||||||
NotificationChannel(
|
NotificationChannel(
|
||||||
@@ -106,10 +106,7 @@ class InstallReceiver : BroadcastReceiver() {
|
|||||||
context.checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) ==
|
context.checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) ==
|
||||||
PackageManager.PERMISSION_GRANTED
|
PackageManager.PERMISSION_GRANTED
|
||||||
) {
|
) {
|
||||||
val open =
|
val open = Intent(context, WatchActivity::class.java)
|
||||||
Intent(context, WatchActivity::class.java)
|
|
||||||
.putExtra("approval", confirmation)
|
|
||||||
.putExtra("job", apk.id)
|
|
||||||
val pending =
|
val pending =
|
||||||
PendingIntent.getActivity(
|
PendingIntent.getActivity(
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class LocalHttpServer(
|
|||||||
response.send(
|
response.send(
|
||||||
200,
|
200,
|
||||||
asset.second,
|
asset.second,
|
||||||
context.assets.open("web/${asset.first}").use { it.readBytes() },
|
context.assets.open(asset.first).use { it.readBytes() },
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -310,9 +310,11 @@ class LocalHttpServer(
|
|||||||
const val PORT = 8787
|
const val PORT = 8787
|
||||||
private val ASSETS =
|
private val ASSETS =
|
||||||
mapOf(
|
mapOf(
|
||||||
"/" to ("index.html" to "text/html; charset=utf-8"),
|
"/" to ("web/index.html" to "text/html; charset=utf-8"),
|
||||||
"/style.css" to ("style.css" to "text/css; charset=utf-8"),
|
"/style.css" to ("web/style.css" to "text/css; charset=utf-8"),
|
||||||
"/app.js" to ("app.js" to "text/javascript; charset=utf-8"),
|
"/app.js" to ("web/app.js" to "text/javascript; charset=utf-8"),
|
||||||
|
"/privacy.txt" to ("legal/privacy.txt" to "text/plain; charset=utf-8"),
|
||||||
|
"/licenses.txt" to ("legal/licenses.txt" to "text/plain; charset=utf-8"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package meghdad.pakkit.transfer
|
package meghdad.pakkit.transfer
|
||||||
|
|
||||||
import android.app.Notification
|
|
||||||
import android.app.NotificationChannel
|
import android.app.NotificationChannel
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
@@ -14,10 +13,14 @@ import android.net.NetworkCapabilities
|
|||||||
import android.net.NetworkRequest
|
import android.net.NetworkRequest
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
import androidx.core.app.NotificationCompat
|
||||||
|
import androidx.wear.ongoing.OngoingActivity
|
||||||
|
import androidx.wear.ongoing.Status
|
||||||
import java.net.BindException
|
import java.net.BindException
|
||||||
import java.net.Inet4Address
|
import java.net.Inet4Address
|
||||||
import java.net.InetAddress
|
import java.net.InetAddress
|
||||||
import meghdad.pakkit.R
|
import meghdad.pakkit.R
|
||||||
|
import meghdad.pakkit.data.PackageStore
|
||||||
import meghdad.pakkit.ui.WatchActivity
|
import meghdad.pakkit.ui.WatchActivity
|
||||||
|
|
||||||
/** User-controlled receiving; network loss suspends the listener, never the user's intent. */
|
/** User-controlled receiving; network loss suspends the listener, never the user's intent. */
|
||||||
@@ -29,6 +32,16 @@ class ReceiveService : Service() {
|
|||||||
private var address: InetAddress? = null
|
private var address: InetAddress? = null
|
||||||
private var registered = false
|
private var registered = false
|
||||||
private var ended = false
|
private var ended = false
|
||||||
|
private lateinit var notification: NotificationCompat.Builder
|
||||||
|
private lateinit var ongoing: OngoingActivity
|
||||||
|
private var notificationState = ""
|
||||||
|
private val store by lazy { PackageStore(this) }
|
||||||
|
private val notificationUpdate = Runnable { updateNotification() }
|
||||||
|
private val sessionObserver: () -> Unit = { scheduleNotification() }
|
||||||
|
private val reviewObserver =
|
||||||
|
android.content.SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
||||||
|
if (key == PackageStore.PENDING_KEY || key == null) main.post { scheduleNotification() }
|
||||||
|
}
|
||||||
private val access = BrowserAccess { request ->
|
private val access = BrowserAccess { request ->
|
||||||
Receiving.update(this) { it.copy(browserRequest = request) }
|
Receiving.update(this) { it.copy(browserRequest = request) }
|
||||||
}
|
}
|
||||||
@@ -76,7 +89,10 @@ class ReceiveService : Service() {
|
|||||||
finish("Receiving stopped")
|
finish("Receiving stopped")
|
||||||
return START_NOT_STICKY
|
return START_NOT_STICKY
|
||||||
}
|
}
|
||||||
if (registered || ended) return START_NOT_STICKY
|
if (registered || ended) {
|
||||||
|
if (!ended) scheduleNotification()
|
||||||
|
return START_NOT_STICKY
|
||||||
|
}
|
||||||
val manager = getSystemService(NotificationManager::class.java)
|
val manager = getSystemService(NotificationManager::class.java)
|
||||||
manager.createNotificationChannel(
|
manager.createNotificationChannel(
|
||||||
NotificationChannel("receive", "App transfers", NotificationManager.IMPORTANCE_LOW)
|
NotificationChannel("receive", "App transfers", NotificationManager.IMPORTANCE_LOW)
|
||||||
@@ -95,20 +111,29 @@ class ReceiveService : Service() {
|
|||||||
Intent(this, ReceiveService::class.java).setAction(STOP),
|
Intent(this, ReceiveService::class.java).setAction(STOP),
|
||||||
PendingIntent.FLAG_IMMUTABLE,
|
PendingIntent.FLAG_IMMUTABLE,
|
||||||
)
|
)
|
||||||
val notification =
|
notification =
|
||||||
Notification.Builder(this, "receive")
|
NotificationCompat.Builder(this, "receive")
|
||||||
.setSmallIcon(R.drawable.pakkit_mark)
|
.setSmallIcon(R.drawable.pakkit_mark)
|
||||||
.setContentTitle("Receiving is on")
|
.setContentTitle("Receiving is on")
|
||||||
.setContentText("Open Pakkit to connect your browser.")
|
.setContentText("Open Pakkit to connect your browser.")
|
||||||
.setContentIntent(open)
|
.setContentIntent(open)
|
||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
.addAction(Notification.Action.Builder(null, "Stop receiving", stop).build())
|
.setOnlyAlertOnce(true)
|
||||||
|
.setCategory(NotificationCompat.CATEGORY_SERVICE)
|
||||||
|
.addAction(0, getString(R.string.watch_end_session), stop)
|
||||||
|
ongoing =
|
||||||
|
OngoingActivity.Builder(this, NOTIFICATION, notification)
|
||||||
|
.setStaticIcon(R.drawable.pakkit_mark)
|
||||||
|
.setTouchIntent(open)
|
||||||
.build()
|
.build()
|
||||||
|
ongoing.apply(this)
|
||||||
startForeground(
|
startForeground(
|
||||||
NOTIFICATION,
|
NOTIFICATION,
|
||||||
notification,
|
notification.build(),
|
||||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE,
|
ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE,
|
||||||
)
|
)
|
||||||
|
Receiving.observe(sessionObserver)
|
||||||
|
store.preferences.registerOnSharedPreferenceChangeListener(reviewObserver)
|
||||||
Receiving.begin(this, access)
|
Receiving.begin(this, access)
|
||||||
try {
|
try {
|
||||||
registered = true
|
registered = true
|
||||||
@@ -127,6 +152,52 @@ class ReceiveService : Service() {
|
|||||||
return START_NOT_STICKY
|
return START_NOT_STICKY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun scheduleNotification() {
|
||||||
|
// Coalesce quick phase changes and stay below the system's notification rate limit.
|
||||||
|
// No repeating idle timer; the latest state is read only after an actual change.
|
||||||
|
if (!ended && !main.hasCallbacks(notificationUpdate))
|
||||||
|
main.postDelayed(notificationUpdate, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateNotification() {
|
||||||
|
if (ended || !::ongoing.isInitialized) return
|
||||||
|
if (
|
||||||
|
android.os.Build.VERSION.SDK_INT >= 33 &&
|
||||||
|
checkSelfPermission(android.Manifest.permission.POST_NOTIFICATIONS) !=
|
||||||
|
android.content.pm.PackageManager.PERMISSION_GRANTED
|
||||||
|
)
|
||||||
|
return
|
||||||
|
val live = Receiving.state
|
||||||
|
val job = store.pending()
|
||||||
|
val (title, detail) =
|
||||||
|
when {
|
||||||
|
live.browserRequest != null ->
|
||||||
|
"Connect browser?" to "Open Pakkit to approve this browser."
|
||||||
|
live.total > 0 -> "Your app is on its way" to "Open Pakkit to follow the transfer."
|
||||||
|
job != null ->
|
||||||
|
when (job.state) {
|
||||||
|
meghdad.pakkit.apk.InstallState.READY ->
|
||||||
|
"Ready to install" to "Review ${job.apk.label} on your watch."
|
||||||
|
meghdad.pakkit.apk.InstallState.CONFIRM ->
|
||||||
|
"Ready for your approval" to "Open Pakkit to continue."
|
||||||
|
meghdad.pakkit.apk.InstallState.INSTALLING ->
|
||||||
|
"Getting ready" to "Your watch will ask you to approve installation."
|
||||||
|
meghdad.pakkit.apk.InstallState.INSTALLED ->
|
||||||
|
"All yours." to "${job.apk.label} is ready to wear."
|
||||||
|
meghdad.pakkit.apk.InstallState.FAILED ->
|
||||||
|
"Couldn’t install" to "Open Pakkit to try again."
|
||||||
|
}
|
||||||
|
live.url == null ->
|
||||||
|
"Waiting for Wi-Fi" to "Receiving will resume when your watch reconnects."
|
||||||
|
else -> "Receiving is on" to "Open Pakkit to connect your browser."
|
||||||
|
}
|
||||||
|
val state = "$title:$detail"
|
||||||
|
if (notificationState == state) return
|
||||||
|
notificationState = state
|
||||||
|
notification.setContentTitle(title).setContentText(detail)
|
||||||
|
ongoing.update(this, Status.forPart(Status.TextPart(detail)))
|
||||||
|
}
|
||||||
|
|
||||||
private fun open(network: Network, address: InetAddress) {
|
private fun open(network: Network, address: InetAddress) {
|
||||||
suspendListener()
|
suspendListener()
|
||||||
this.network = network
|
this.network = network
|
||||||
@@ -166,6 +237,8 @@ class ReceiveService : Service() {
|
|||||||
|
|
||||||
private fun release(message: String) {
|
private fun release(message: String) {
|
||||||
main.removeCallbacksAndMessages(null)
|
main.removeCallbacksAndMessages(null)
|
||||||
|
Receiving.removeObserver(sessionObserver)
|
||||||
|
store.preferences.unregisterOnSharedPreferenceChangeListener(reviewObserver)
|
||||||
server?.close()
|
server?.close()
|
||||||
server = null
|
server = null
|
||||||
if (registered) runCatching { connectivity.unregisterNetworkCallback(callback) }
|
if (registered) runCatching { connectivity.unregisterNetworkCallback(callback) }
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package meghdad.pakkit.ui
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.Gravity
|
||||||
|
import meghdad.pakkit.R
|
||||||
|
|
||||||
|
/** Offline disclosures remain available even when receiving is off. */
|
||||||
|
class AboutActivity : Activity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
val scroll = RoundScrollView(this).apply { setBackgroundColor(WatchColors.canvas) }
|
||||||
|
val column =
|
||||||
|
WatchDesign.column(this).apply {
|
||||||
|
val side =
|
||||||
|
WatchDesign.dp(
|
||||||
|
this@AboutActivity,
|
||||||
|
(resources.configuration.screenWidthDp * .15f).toInt(),
|
||||||
|
)
|
||||||
|
setPadding(
|
||||||
|
side,
|
||||||
|
WatchDesign.dp(this@AboutActivity, 28),
|
||||||
|
side,
|
||||||
|
WatchDesign.dp(this@AboutActivity, 64),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val licenses = intent.getBooleanExtra("licenses", false)
|
||||||
|
val text =
|
||||||
|
assets
|
||||||
|
.open(if (licenses) "legal/licenses.txt" else "legal/privacy.txt")
|
||||||
|
.bufferedReader()
|
||||||
|
.use { it.readText() }
|
||||||
|
text.trim().split("\n\n").forEachIndexed { index, paragraph ->
|
||||||
|
val heading = index == 0 || (!licenses && paragraph.length < 40)
|
||||||
|
column.addView(
|
||||||
|
WatchDesign.text(
|
||||||
|
this,
|
||||||
|
paragraph,
|
||||||
|
if (index == 0) 20f else if (heading) 16f else 13f,
|
||||||
|
bold = heading,
|
||||||
|
)
|
||||||
|
.apply {
|
||||||
|
gravity = if (index == 0) Gravity.CENTER else Gravity.START
|
||||||
|
isAccessibilityHeading = heading
|
||||||
|
},
|
||||||
|
android.widget.LinearLayout.LayoutParams(-1, -2).apply {
|
||||||
|
bottomMargin = WatchDesign.dp(this@AboutActivity, 14)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (!licenses)
|
||||||
|
column.addView(
|
||||||
|
WatchDesign.button(this, getString(R.string.watch_licenses), false) {
|
||||||
|
startActivity(
|
||||||
|
android.content
|
||||||
|
.Intent(this, AboutActivity::class.java)
|
||||||
|
.putExtra("licenses", true)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
column.addView(WatchDesign.button(this, getString(R.string.watch_done), false) { finish() })
|
||||||
|
scroll.addView(column)
|
||||||
|
setContentView(scroll)
|
||||||
|
scroll.isFocusableInTouchMode = true
|
||||||
|
scroll.requestFocus()
|
||||||
|
savedInstanceState?.getInt("scroll")?.let { y -> scroll.post { scroll.scrollTo(0, y) } }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
val content = findViewById<android.view.ViewGroup>(android.R.id.content)
|
||||||
|
outState.putInt("scroll", (content.getChildAt(0) as RoundScrollView).scrollY)
|
||||||
|
super.onSaveInstanceState(outState)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,8 @@ import android.widget.ImageView
|
|||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.ProgressBar
|
import android.widget.ProgressBar
|
||||||
import android.widget.TextClock
|
import android.widget.TextClock
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
import meghdad.pakkit.R
|
import meghdad.pakkit.R
|
||||||
@@ -42,13 +44,17 @@ class WatchActivity : Activity(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
private var resumed = false
|
private var resumed = false
|
||||||
private var approvalLaunched: Int? = null
|
private var approvalLaunched: Int? = null
|
||||||
private var requestedInstallId: String? = null
|
private var requestedInstallId: String? = null
|
||||||
|
private var progressTitle: TextView? = null
|
||||||
|
private var progressPercent: TextView? = null
|
||||||
|
private var progressDetail: TextView? = null
|
||||||
|
private var progressBar: ProgressBar? = null
|
||||||
private var qrUrl = ""
|
private var qrUrl = ""
|
||||||
private var qrBitmap: android.graphics.Bitmap? = null
|
private var qrBitmap: android.graphics.Bitmap? = null
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
installSplashScreen()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
store = PackageStore(this)
|
store = PackageStore(this)
|
||||||
acceptIntent(intent)
|
|
||||||
requestedInstallId = savedInstanceState?.getString("requestedInstallId")
|
requestedInstallId = savedInstanceState?.getString("requestedInstallId")
|
||||||
approvalLaunched = savedInstanceState?.getInt("approvalLaunched", -1)?.takeIf { it >= 0 }
|
approvalLaunched = savedInstanceState?.getInt("approvalLaunched", -1)?.takeIf { it >= 0 }
|
||||||
refresh()
|
refresh()
|
||||||
@@ -65,24 +71,9 @@ class WatchActivity : Activity(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
override fun onNewIntent(intent: Intent) {
|
override fun onNewIntent(intent: Intent) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
setIntent(intent)
|
setIntent(intent)
|
||||||
acceptIntent(intent)
|
|
||||||
refresh()
|
refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun acceptIntent(intent: Intent) {
|
|
||||||
val job = store.pending()
|
|
||||||
@Suppress("DEPRECATION") val approval = intent.getParcelableExtra<Intent>("approval")
|
|
||||||
if (
|
|
||||||
approval != null &&
|
|
||||||
job != null &&
|
|
||||||
job.id == intent.getStringExtra("job") &&
|
|
||||||
job.state == InstallState.CONFIRM
|
|
||||||
) {
|
|
||||||
PendingApproval.intent = approval
|
|
||||||
PendingApproval.id = job.id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
resumed = true
|
resumed = true
|
||||||
@@ -207,6 +198,12 @@ class WatchActivity : Activity(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
live.active -> "connecting"
|
live.active -> "connecting"
|
||||||
else -> "home"
|
else -> "home"
|
||||||
}
|
}
|
||||||
|
// Keep the same view tree while bytes arrive: TalkBack, rotary focus and
|
||||||
|
// scroll position must survive progress updates without repeated layout work.
|
||||||
|
if (stateKey == "uploading" && renderedState == stateKey && error == null) {
|
||||||
|
updateProgress(live)
|
||||||
|
return
|
||||||
|
}
|
||||||
val previousState = renderedState
|
val previousState = renderedState
|
||||||
if (stateKey != previousState) error = null
|
if (stateKey != previousState) error = null
|
||||||
val y = if (::scroll.isInitialized && stateKey == renderedState) scroll.scrollY else 0
|
val y = if (::scroll.isInitialized && stateKey == renderedState) scroll.scrollY else 0
|
||||||
@@ -248,6 +245,18 @@ class WatchActivity : Activity(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
button(getString(R.string.watch_start_receiving), false) { startReceiving() }
|
button(getString(R.string.watch_start_receiving), false) { startReceiving() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
live.active &&
|
||||||
|
live.browserRequest == null &&
|
||||||
|
job?.state != InstallState.CONFIRM &&
|
||||||
|
Build.VERSION.SDK_INT >= 33 &&
|
||||||
|
checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) !=
|
||||||
|
PackageManager.PERMISSION_GRANTED
|
||||||
|
) {
|
||||||
|
button(getString(R.string.watch_enable_alerts), false) {
|
||||||
|
requestPermissions(arrayOf(Manifest.permission.POST_NOTIFICATIONS), 52)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scroll.isFocusable = true
|
scroll.isFocusable = true
|
||||||
scroll.isFocusableInTouchMode = true
|
scroll.isFocusableInTouchMode = true
|
||||||
@@ -288,35 +297,20 @@ class WatchActivity : Activity(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
if (url != null) {
|
if (url != null) {
|
||||||
if (live.total > 0) {
|
if (live.total > 0) {
|
||||||
parcel(48)
|
parcel(48)
|
||||||
val percent = (live.received * 100 / live.total).coerceAtMost(100)
|
progressTitle = line(getString(R.string.watch_on_its_way), 22f, bold = true)
|
||||||
add(
|
add(requireNotNull(progressTitle), 10)
|
||||||
line(
|
progressPercent = line("0%", 30f, colors.mint, true)
|
||||||
if (percent == 100L) getString(R.string.watch_just_checking)
|
add(requireNotNull(progressPercent), 10)
|
||||||
else getString(R.string.watch_on_its_way),
|
progressBar =
|
||||||
22f,
|
|
||||||
bold = true,
|
|
||||||
),
|
|
||||||
10,
|
|
||||||
)
|
|
||||||
add(line("$percent%", 30f, colors.mint, true), 10)
|
|
||||||
add(
|
|
||||||
ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal).apply {
|
ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal).apply {
|
||||||
max = 100
|
max = 100
|
||||||
progress = percent.toInt()
|
|
||||||
progressTintList = android.content.res.ColorStateList.valueOf(colors.mint)
|
progressTintList = android.content.res.ColorStateList.valueOf(colors.mint)
|
||||||
contentDescription = getString(R.string.watch_percent_received, percent)
|
}
|
||||||
},
|
add(requireNotNull(progressBar), 12)
|
||||||
12,
|
progressDetail =
|
||||||
)
|
line(getString(R.string.watch_keep_your_browser_open), 13f, colors.secondary)
|
||||||
add(
|
add(requireNotNull(progressDetail), 10)
|
||||||
line(
|
updateProgress(live)
|
||||||
if (percent == 100L) getString(R.string.watch_getting_your_app_ready)
|
|
||||||
else getString(R.string.watch_keep_your_browser_open),
|
|
||||||
13f,
|
|
||||||
colors.secondary,
|
|
||||||
),
|
|
||||||
10,
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
if (qrUrl != url || qrBitmap == null) {
|
if (qrUrl != url || qrBitmap == null) {
|
||||||
val matrix =
|
val matrix =
|
||||||
@@ -414,6 +408,31 @@ class WatchActivity : Activity(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
refresh()
|
refresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!live.active)
|
||||||
|
button(getString(R.string.watch_privacy), false) {
|
||||||
|
startActivity(Intent(this, AboutActivity::class.java))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateProgress(live: Receiving.State) {
|
||||||
|
val percent = ((live.received.toDouble() / live.total) * 100).toInt().coerceIn(0, 100)
|
||||||
|
val title =
|
||||||
|
getString(
|
||||||
|
if (percent == 100) R.string.watch_just_checking else R.string.watch_on_its_way
|
||||||
|
)
|
||||||
|
val detail =
|
||||||
|
getString(
|
||||||
|
if (percent == 100) R.string.watch_getting_your_app_ready
|
||||||
|
else R.string.watch_keep_your_browser_open
|
||||||
|
)
|
||||||
|
if (progressTitle?.text != title) progressTitle?.text = title
|
||||||
|
if (progressDetail?.text != detail) progressDetail?.text = detail
|
||||||
|
val label = "$percent%"
|
||||||
|
if (progressPercent?.text != label) {
|
||||||
|
progressPercent?.text = label
|
||||||
|
progressBar?.progress = percent
|
||||||
|
progressBar?.contentDescription = getString(R.string.watch_percent_received, percent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startReceiving() {
|
private fun startReceiving() {
|
||||||
@@ -548,8 +567,7 @@ class WatchActivity : Activity(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
InstallState.INSTALLED -> {
|
InstallState.INSTALLED -> {
|
||||||
button(getString(R.string.watch_open_app)) { launch(apk.packageName) }
|
button(getString(R.string.watch_open_app)) { launch(apk.packageName) }
|
||||||
button(getString(R.string.watch_done), false) {
|
button(getString(R.string.watch_done), false) {
|
||||||
store.dismiss(job.id)
|
dismiss(job)
|
||||||
refresh()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -563,6 +581,7 @@ class WatchActivity : Activity(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||||
if (requestCode == 52) {
|
if (requestCode == 52) {
|
||||||
meghdad.pakkit.install.InstallReceiver.notifyApproval(this)
|
meghdad.pakkit.install.InstallReceiver.notifyApproval(this)
|
||||||
|
if (Receiving.state.active) startService(Intent(this, ReceiveService::class.java))
|
||||||
refresh()
|
refresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -599,7 +618,10 @@ class WatchActivity : Activity(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
|
|
||||||
private fun dismiss(job: PendingApk) {
|
private fun dismiss(job: PendingApk) {
|
||||||
PendingApproval.clear()
|
PendingApproval.clear()
|
||||||
store.dismiss(job.id)
|
runCatching { store.dismiss(job.id) }
|
||||||
|
.onFailure {
|
||||||
|
error = it.userMessage("Couldn’t remove this app. Try again.")
|
||||||
|
}
|
||||||
refresh()
|
refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import android.widget.LinearLayout
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
|
||||||
object WatchColors {
|
object WatchColors {
|
||||||
const val canvas = 0xFF090B17.toInt()
|
const val canvas = Color.BLACK
|
||||||
const val raised = 0xFF1C2035.toInt()
|
const val raised = 0xFF1C2035.toInt()
|
||||||
const val text = 0xFFF4F2FF.toInt()
|
const val text = 0xFFF4F2FF.toInt()
|
||||||
const val secondary = 0xFFB7B6CE.toInt()
|
const val secondary = 0xFFB7B6CE.toInt()
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:width="48dp" android:height="48dp"
|
||||||
|
android:drawable="@mipmap/pakkit_launcher" android:gravity="center" />
|
||||||
|
</layer-list>
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<string name="watch_privacy">Privacy</string>
|
||||||
|
<string name="watch_licenses">Open-source licenses</string>
|
||||||
<string name="watch_end_session">Stop receiving</string>
|
<string name="watch_end_session">Stop receiving</string>
|
||||||
<string name="watch_just_checking">Just checking…</string>
|
<string name="watch_just_checking">Just checking…</string>
|
||||||
<string name="watch_on_its_way">On its way</string>
|
<string name="watch_on_its_way">On its way</string>
|
||||||
|
|||||||
@@ -3,9 +3,13 @@
|
|||||||
<style name="Theme.Pakkit" parent="android:style/Theme.Material.NoActionBar">
|
<style name="Theme.Pakkit" parent="android:style/Theme.Material.NoActionBar">
|
||||||
<item name="android:fontFamily">sans</item>
|
<item name="android:fontFamily">sans</item>
|
||||||
<item name="android:colorAccent">#BAA6FF</item>
|
<item name="android:colorAccent">#BAA6FF</item>
|
||||||
<item name="android:windowBackground">#090B17</item>
|
<item name="android:windowBackground">@android:color/black</item>
|
||||||
|
<item name="android:windowSwipeToDismiss">true</item>
|
||||||
<item name="android:windowLightStatusBar">false</item>
|
<item name="android:windowLightStatusBar">false</item>
|
||||||
<item name="android:windowSplashScreenBackground">#090B17</item>
|
</style>
|
||||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/pakkit_icon</item>
|
<style name="Theme.Pakkit.Starting" parent="Theme.SplashScreen">
|
||||||
|
<item name="windowSplashScreenBackground">@android:color/black</item>
|
||||||
|
<item name="windowSplashScreenAnimatedIcon">@drawable/pakkit_splash</item>
|
||||||
|
<item name="postSplashScreenTheme">@style/Theme.Pakkit</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -10,7 +10,7 @@ Pakkit is a Wear OS application that serves its bundled HTML/CSS/JavaScript inte
|
|||||||
| `data` | Private files and one durable package review |
|
| `data` | Private files and one durable package review |
|
||||||
| `install` | User-requested Android sessions, system consent and verified installer callbacks |
|
| `install` | User-requested Android sessions, system consent and verified installer callbacks |
|
||||||
|
|
||||||
There is no frontend build step, CDN, cloud relay, account or transfer backend. ZXing Core is the only explicit runtime library. `qa/fixture` supplies a signed test APK to instrumentation only; browser tools and large generated fixtures never ship.
|
There is no frontend build step, CDN, cloud relay, account or transfer backend. ZXing Core generates QR codes. AndroidX Core, Wear Ongoing and SplashScreen supply platform notification and launch behavior. `qa/fixture` supplies a signed test APK to instrumentation only; browser tools and large generated fixtures never ship.
|
||||||
|
|
||||||
## Receiving lifecycle
|
## Receiving lifecycle
|
||||||
|
|
||||||
@@ -43,3 +43,9 @@ Only a watch action starts ApkInstaller. Returning from granting source permissi
|
|||||||
MODE_FULL_INSTALL and USER_ACTION_REQUIRED preserve supported system consent. The non-exported receiver accepts only the active job, matching non-null session ID and expected state. When Pakkit is visible, Android's returned consent intent opens once automatically; Continue is available for recovery. Optional notification denial does not block in-app approval. Native INSTALLED state only follows Android STATUS_SUCCESS.
|
MODE_FULL_INSTALL and USER_ACTION_REQUIRED preserve supported system consent. The non-exported receiver accepts only the active job, matching non-null session ID and expected state. When Pakkit is visible, Android's returned consent intent opens once automatically; Continue is available for recovery. Optional notification denial does not block in-app approval. Native INSTALLED state only follows Android STATUS_SUCCESS.
|
||||||
|
|
||||||
See [restriction rationale](RESTRICTIONS.md), [platform constraints](PLATFORM.md) and [validation](VALIDATION.md) for the distinction between product behavior and OS/distribution requirements.
|
See [restriction rationale](RESTRICTIONS.md), [platform constraints](PLATFORM.md) and [validation](VALIDATION.md) for the distinction between product behavior and OS/distribution requirements.
|
||||||
|
|
||||||
|
## Platform presentation and disclosures
|
||||||
|
|
||||||
|
Watch upload progress mutates existing views so rotary and accessibility focus survive updates. AndroidX SplashScreen supplies Wear launch sizing. ReceiveService attaches a Wear OngoingActivity to its foreground notification; actual phase changes schedule a coalesced notification update, with no repeating idle timer. The static indicator and content intent return to the live receiving flow. Notification denial leaves in-app receiving available.
|
||||||
|
|
||||||
|
AboutActivity is private and exposes bundled privacy text and third-party notices with receiving off. The web server’s fixed asset allowlist additionally exposes `/privacy.txt` and `/licenses.txt`; those routes reveal no package or access data. The launcher accepts no installer approval extras. A valid private installer callback owns in-memory PendingApproval; after process loss, the watch offers an explicit retry.
|
||||||
+4
-2
@@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
## Themes and layout
|
## Themes and layout
|
||||||
|
|
||||||
The native watch UI uses midnight `#090B17` to limit lit OLED pixels, lavender-white text and semantic mint/error surfaces. Body and secondary copy, badges and action gradient endpoints have automated contrast checks. Actions have a minimum 48 dp height and scalable text. Proportional margins and bottom padding allow controls to move into the usable center of a round display. The QR is sized to screen width and positioned within the circular safe area; the ordinary fixed-port address is readable below the QR, without a link-details step. The home screen pairs a compact parcel/wordmark with a visible receiving action. Source permission is requested at the app review, where its purpose is clear.
|
The native watch UI uses black `#000000` to limit lit OLED pixels, lavender-white text and semantic mint/error surfaces. Body and secondary copy, badges and action gradient endpoints have automated contrast checks. Actions have a minimum 48 dp height and scalable text. Proportional margins and bottom padding allow controls to move into the usable center of a round display. The QR is sized to screen width and positioned within the circular safe area; the ordinary fixed-port address is readable below the QR, without a link-details step. The home screen pairs a compact parcel/wordmark with a visible receiving action. Source permission is requested at the app review, where its purpose is clear.
|
||||||
|
|
||||||
The browser leads with the official tagline, original parcel artwork and a compact Choose / Send / Wear indicator. The compact state indicator replaces a lengthy journey explainer. It follows prefers-color-scheme with an explicit in-session toggle. Dark is midnight with violet/cyan lighting; light uses soft lavender and white surfaces. A two-column desktop layout becomes a single-column layout at smaller widths. The maintained CSS, HTML and JavaScript are readable source files, formatted with the optional web development tools. Native browser controls, semantic headings, focus rings, file labels and a live status region support keyboard and assistive access.
|
The browser leads with the official tagline, original parcel artwork and a compact Choose / Send / Wear indicator. The compact state indicator replaces a lengthy journey explainer. It follows prefers-color-scheme with an explicit remembered toggle. Dark is midnight with violet/cyan lighting; light uses soft lavender and white surfaces. A two-column desktop layout becomes a single-column layout at smaller widths. The maintained CSS, HTML and JavaScript are readable source files, formatted with the optional web development tools. Native browser controls, semantic headings, focus rings, file labels and a live status region support keyboard and assistive access.
|
||||||
|
|
||||||
## Motion and product states
|
## Motion and product states
|
||||||
|
|
||||||
@@ -41,3 +41,5 @@ Write for the person wearing the watch: short, warm, specific and calm. Let the
|
|||||||
| Failure | Couldn’t install + specific recovery | Let’s try that again + specific recovery |
|
| Failure | Couldn’t install + specific recovery | Let’s try that again + specific recovery |
|
||||||
|
|
||||||
Watch screen copy lives in Android string resources. Deliberately written package-validation messages are marked with `UserMessage`; unknown file/platform exceptions are replaced with recovery copy at the UI boundary, while installer diagnostics stay in logs. Notification copy follows the same voice. There are no key-entry forms, expiry countdowns, file-size warnings or repeated watch-layout warnings. The app name and official tagline are shared branding resources. Browser result changes are announced with a live region, and color is never the only state indicator.
|
Watch screen copy lives in Android string resources. Deliberately written package-validation messages are marked with `UserMessage`; unknown file/platform exceptions are replaced with recovery copy at the UI boundary, while installer diagnostics stay in logs. Notification copy follows the same voice. There are no key-entry forms, expiry countdowns, file-size warnings or repeated watch-layout warnings. The app name and official tagline are shared branding resources. Browser result changes are announced with a live region, and color is never the only state indicator.
|
||||||
|
|
||||||
|
Final polish: the watch uses a black canvas and a launcher-matched 48 dp branded splash. Receiving remains reachable from the watch face through the official Ongoing Activity. Progress preserves the same view tree; notification phase changes are coalesced and silent. Privacy is a quiet home action with offline text and readable paragraph headings. The browser retains theme choice and moves keyboard focus out of disappearing controls without stealing it during polling.
|
||||||
@@ -70,3 +70,15 @@ The resulting APK is about 66 MiB. `--bytes` can select another asset size based
|
|||||||
```
|
```
|
||||||
|
|
||||||
Hardware testing is a final compatibility/power gate, documented in VALIDATION.md, rather than a routine development requirement.
|
Hardware testing is a final compatibility/power gate, documented in VALIDATION.md, rather than a routine development requirement.
|
||||||
|
|
||||||
|
## Release-candidate review
|
||||||
|
|
||||||
|
After the complete debug/test/release build and `./gradlew :app:lintDebug :app:lintRelease`, run `python3 scripts/check-release.py`. It saves an artifact digest, packaging/manifest results, lint warnings and publication gates under `app/build/reports/validation/release-audit.json`. This check does not submit an app or verify an upload certificate.
|
||||||
|
|
||||||
|
For large-file receipt followed by real process-death recovery, use:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python3 scripts/test-emulators.py --watch emulator-5554 --browser emulator-5556 --large --restart --skip-build
|
||||||
|
```
|
||||||
|
|
||||||
|
The restart option backgrounds and kills only the selected emulator’s debug Pakkit process with `run-as`. It confirms the received review survives, receiving must be explicitly restarted and port 8787 is reused. Do not overlap instrumentation and `uiautomator` commands on the same emulator. The suite includes a real watch Install action and Android Install/Update confirmation; it leaves the disposable QA fixture installed. The ongoing-notification test grants optional notification access on the emulator and retains it to avoid killing the running instrumentation process. Source permission is still exercised through the normal system setting, never a test grant.
|
||||||
@@ -13,3 +13,5 @@ Partial/rejected uploads are deleted. Successful installation or dismissing the
|
|||||||
Receiving remains enabled until the user stops it or the operating system ends it. Network loss suspends the listener and interrupts an active upload; receiving resumes when Wi-Fi returns. Ending network access does not cancel an already committed Android installation. Process death requires starting receiving and approving browser access again.
|
Receiving remains enabled until the user stops it or the operating system ends it. Network loss suspends the listener and interrupts an active upload; receiving resumes when Wi-Fi returns. Ending network access does not cancel an already committed Android installation. Process death requires starting receiving and approving browser access again.
|
||||||
|
|
||||||
Before publication, supply the legal developer identity, support contact and hosted privacy-policy URL. Reconcile the final binary, system behavior and Google Play Data safety declaration. This file is the product disclosure source, not a completed Play submission.
|
Before publication, supply the legal developer identity, support contact and hosted privacy-policy URL. Reconcile the final binary, system behavior and Google Play Data safety declaration. This file is the product disclosure source, not a completed Play submission.
|
||||||
|
|
||||||
|
The application includes an offline disclosure under **Privacy** on the watch home screen. The browser serves the same text and open-source acknowledgements from bundled assets. AndroidX profile initialization runs locally; it adds no analytics backend. The hosted publication policy still needs a real support contact. Local HTTP’s compatibility with the final User Data/Data safety assessment must be resolved before publication; transparency about plaintext transport alone is not a compliance determination. See [product review](PRODUCT_REVIEW.md).
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# Product and release review
|
||||||
|
|
||||||
|
Review date: October 15, 2026. This is a release-candidate assessment, not a Google Play approval or a certification of all watch firmware.
|
||||||
|
|
||||||
|
## Product refinements implemented
|
||||||
|
|
||||||
|
- Watch backgrounds are black while purple, mint, the parcel mark and the official **Pack it. Send it. Wear it.** identity remain consistent. The launcher-matched 48 dp splash uses AndroidX’s Wear-aware sizing; native swipe dismissal remains enabled.
|
||||||
|
- Upload progress updates the existing watch view tree, preserving rotary/keyboard/accessibility focus and avoiding repeated full-screen layouts. Percentage arithmetic handles 64-bit lengths without integer overflow.
|
||||||
|
- Receiving has a Wear Ongoing Activity with a static, battery-conscious icon, a return-to-app intent and a Stop action. Notification copy changes at meaningful phases, not on every byte. Optional Enable alerts is available while receiving; denied notification access does not block transfers.
|
||||||
|
- The browser keeps keyboard focus when panels change, preserves result-button focus across polls, remembers theme preference and recovers from stalled connection requests. Uploads still have no total deadline. Reduced motion, responsive layout and both themes remain supported.
|
||||||
|
- Privacy is available offline from the watch home screen. Browser Privacy and Open-source licenses links serve bundled text from an explicit route allowlist. APKs and browser credentials never appear in those documents.
|
||||||
|
- Failed file-removal persistence restores the previous review and retains its APK. The watch shows a recoverable error instead of crashing. The exported launcher no longer accepts installer intents in arbitrary incoming extras; only the private, session-matched installer callback supplies approval state.
|
||||||
|
|
||||||
|
## Evidence and limits
|
||||||
|
|
||||||
|
See [validation](VALIDATION.md) for the final test counts, emulator configuration and generated evidence. The build audit is reproducible with `python3 scripts/check-release.py`. It checks the merged release manifest, exact bundled assets, permissions, exported components, native-library absence, lint errors and bundle signature presence. It records a SHA-256 digest. It does not cryptographically verify signing, decode the bundle’s protobuf manifest or submit the app to Play.
|
||||||
|
|
||||||
|
AndroidX Core, Wear Ongoing and SplashScreen are intentional dependencies for official platform presentation. Core adds a signature-protected dynamic-receiver permission. Its profile installer contributes a private startup provider and a DUMP-protected receiver. These do not add user data collection or ordinary third-party access. There are no native `.so` libraries, so this artifact has no 32-bit-only native payload; testing uses a 64-bit ARM Wear image. Reassess native ABI and 16 KB page compatibility if native libraries are added.
|
||||||
|
|
||||||
|
## Policy review
|
||||||
|
|
||||||
|
| Requirement | Assessment and remaining action |
|
||||||
|
| --- | --- |
|
||||||
|
| Target API | Target 36 exceeds the Wear minimum of 35 effective August 31, 2026. [Current target API policy](https://support.google.com/googleplay/android-developer/answer/11926878?hl=en). The Wear quality overview still references the 2025 API threshold; the dedicated policy is the source for the current submission threshold. |
|
||||||
|
| Wear quality | Black background, scaled text, 48 dp actions, 192/227 dp round testing, scroll indicator, swipe dismissal, state restoration, splash and Ongoing Activity are implemented. TalkBack, physical rotary/QR and long-duration power behavior still need final device validation. [Quality checklist](https://developer.android.com/docs/quality-guidelines/wear-app-quality), [splash](https://developer.android.com/training/wearables/apps/splash-screen), [ongoing work](https://developer.android.com/training/wearables/notifications/ongoing-activity). |
|
||||||
|
| Restricted installation | Local package transfer is core functionality and user-initiated installation is explicit. This appears to fit the file-sharing/transfer category; approval remains a Play review decision. Submit an accurate permission declaration and demonstration. Self-updates remain blocked. [Installation policy](https://support.google.com/googleplay/android-developer/answer/12085295?hl=en). |
|
||||||
|
| Foreground service | connectedDevice is declared for explicit receiving over a network, has an ongoing indicator and Stop action, and does not start at boot. Declare its user-triggered use and supply a video. Review must cover extended waiting while the user leaves receiving enabled. [FGS requirements](https://support.google.com/googleplay/android-developer/answer/13392821?hl=en). |
|
||||||
|
| Privacy and transport | No developer backend, analytics, account or remote assets. Local HTTP carries APKs and credentials without encryption. Watch approval protects access but does not protect traffic. The User Data policy requires secure handling of personal/sensitive data; disclosure alone does not establish compliance. Confirm the final local-transfer use case and Data safety answers before publication. If stronger transport protection is required, implement and validate a trusted-browser solution before shipping. [User Data](https://support.google.com/googleplay/android-developer/answer/10144311?hl=en), [Data safety](https://support.google.com/googleplay/android-developer/answer/10787469?hl=en). |
|
||||||
|
| Developer verification | Do not promise universal installation of unregistered apps. Current regional enforcement and supported advanced flows are system/store decisions; firmware and regional applicability require final checking. Pakkit does not bypass them. [Developer verification](https://developer.android.com/developer-verification). |
|
||||||
|
| Signing | Optimized AAB builds; incomplete signing inputs fail. Current local artifact is unsigned. Supply the upload key, verify its certificate and enroll in Play App Signing. Protect the upload key outside Git; increment versionCode per submission. |
|
||||||
|
| Listing and access | English listing draft is prepared in [store listing](STORE_LISTING.md). Supply a real support contact, hosted policy, icon/feature graphic and actual unmasked square Wear screenshots. Give reviewers same-Wi-Fi setup steps and a redistributable test APK. Complete content rating, audience/ads, app access, Data safety and permission/FGS forms. [Wear distribution](https://developer.android.com/training/wearables/packaging), [preview assets](https://support.google.com/googleplay/android-developer/answer/9866151?hl=en). |
|
||||||
|
|
||||||
|
## Publication gates
|
||||||
|
|
||||||
|
1. Supply and verify production signing, developer/support identity, hosted privacy policy and store artwork. Rebuild through trusted dependency repositories; this environment required the existing optional Google Maven mirror for new AndroidX artifacts.
|
||||||
|
2. Complete the concise hardware/browser/runtime matrix in [validation](VALIDATION.md), including minimum API 31. Only API 37 system images were available locally for this run; lint is not a substitute for minimum-version execution.
|
||||||
|
3. Resolve the transport/Data safety policy assessment and obtain restricted-permission, FGS and Wear review acceptance. Exercise fresh Play delivery through internal/closed testing and review its pre-launch report before public promotion.
|
||||||
|
|
||||||
|
No physical watch access is needed for routine development. There is no claim of measured hardware battery life, indefinite receiving under all OS conditions, malware safety or universal APK compatibility.
|
||||||
+5
-3
@@ -5,7 +5,7 @@
|
|||||||
Publish the app module’s Wear OS AAB: application ID `meghdad.pakkit`, version 0.3.0/code 100004, min 31/target 36/compile 36.1. It declares required watch hardware and standalone=true. Increment versionCode for each upload. R 8 and resource shrinking are enabled.
|
Publish the app module’s Wear OS AAB: application ID `meghdad.pakkit`, version 0.3.0/code 100004, min 31/target 36/compile 36.1. It declares required watch hardware and standalone=true. Increment versionCode for each upload. R 8 and resource shrinking are enabled.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./gradlew :app:bundleRelease
|
./gradlew :app:bundleRelease :app:lintDebug :app:lintRelease
|
||||||
```
|
```
|
||||||
|
|
||||||
Output: app/build/outputs/bundle/release/app-release.aab. Production signing uses PAKKIT_KEYSTORE, PAKKIT_KEYSTORE_PASSWORD, PAKKIT_KEY_ALIAS and PAKKIT_KEY_PASSWORD. Set all four; incomplete/blank signing configuration fails clearly. With all unset, the bundle is unsigned and must be signed through the release pipeline. Keep keys and passwords outside source control. Application ID and private review schema are stable across updates; source class/package refactoring does not require data migration.
|
Output: app/build/outputs/bundle/release/app-release.aab. Production signing uses PAKKIT_KEYSTORE, PAKKIT_KEYSTORE_PASSWORD, PAKKIT_KEY_ALIAS and PAKKIT_KEY_PASSWORD. Set all four; incomplete/blank signing configuration fails clearly. With all unset, the bundle is unsigned and must be signed through the release pipeline. Keep keys and passwords outside source control. Application ID and private review schema are stable across updates; source class/package refactoring does not require data migration.
|
||||||
@@ -16,12 +16,14 @@ Output: app/build/outputs/bundle/release/app-release.aab. Production signing use
|
|||||||
| -------------------------------------------------------- | ------------------------------------------------------------------------- |
|
| -------------------------------------------------------- | ------------------------------------------------------------------------- |
|
||||||
| INTERNET | Local listener and HTTP responses |
|
| INTERNET | Local listener and HTTP responses |
|
||||||
| ACCESS_NETWORK_STATE / CHANGE_NETWORK_STATE | Request/watch the Wi-Fi network and handle connectivity lifecycle |
|
| ACCESS_NETWORK_STATE / CHANGE_NETWORK_STATE | Request/watch the Wi-Fi network and handle connectivity lifecycle |
|
||||||
| WAKE_LOCK | Timed partial CPU lock during a receiving session |
|
| WAKE_LOCK | Partial CPU lock only while streaming/inspecting an upload; released in finally |
|
||||||
| FOREGROUND_SERVICE / FOREGROUND_SERVICE_CONNECTED_DEVICE | Explicit local receiving service with stop action |
|
| FOREGROUND_SERVICE / FOREGROUND_SERVICE_CONNECTED_DEVICE | Explicit local receiving service with stop action |
|
||||||
| REQUEST_INSTALL_PACKAGES | Watch-initiated system installation after review |
|
| REQUEST_INSTALL_PACKAGES | Watch-initiated system installation after review |
|
||||||
| POST_NOTIFICATIONS | Optional session/approval alerts; in-app consent remains usable if denied |
|
| POST_NOTIFICATIONS | Optional session/approval alerts; in-app consent remains usable if denied |
|
||||||
|
|
||||||
No package-visibility queries, broad storage, location, Bluetooth, boot receiver or unrestricted installed-app enumeration is required. Inspect merged release permissions and verify fixture/test assets are absent. Release runtime dependencies are ZXing Core and the Kotlin standard library with its annotations dependency; browser development tools are separate.
|
No package-visibility queries, broad storage, location, Bluetooth, boot receiver or unrestricted installed-app enumeration is required. Inspect merged release permissions and verify fixture/test assets are absent. Release runtime dependencies include ZXing Core, AndroidX Core/Wear Ongoing/SplashScreen and their transitive support libraries, plus Kotlin. Browser development tools are separate. AndroidX adds a signature-only dynamic-receiver permission, a private profile-initialization provider and a DUMP-protected profile receiver. These are audited in the merged manifest.
|
||||||
|
|
||||||
|
Run `python3 scripts/check-release.py` after building to validate release packaging and save a bundle digest. See [final product review](PRODUCT_REVIEW.md) for current policy sources, the publication decision and [store copy](STORE_LISTING.md).
|
||||||
|
|
||||||
## Publication gates
|
## Publication gates
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# Store listing draft
|
||||||
|
|
||||||
|
English copy for the current product. Do not publish until the gates in [product review](PRODUCT_REVIEW.md) are complete.
|
||||||
|
|
||||||
|
## App name
|
||||||
|
|
||||||
|
Pakkit
|
||||||
|
|
||||||
|
## Short description
|
||||||
|
|
||||||
|
Send APKs from your browser to your Wear OS watch. Install on your terms.
|
||||||
|
|
||||||
|
## Full description
|
||||||
|
|
||||||
|
Pack it. Send it. Wear it.
|
||||||
|
|
||||||
|
Give your next app a place on your wrist. Pakkit brings APKs from your browser to your Wear OS watch, with a thoughtful experience from the first connection to the final tap.
|
||||||
|
|
||||||
|
Open Pakkit, start receiving and scan the code or open the address on any device with a compatible browser. Choose your APK, follow its progress, then review and approve installation on your watch.
|
||||||
|
|
||||||
|
• Connect with a quick approval on your watch.
|
||||||
|
• Send files directly over your Wi-Fi.
|
||||||
|
• Follow your transfer on both screens.
|
||||||
|
• Review every app before installation.
|
||||||
|
• Keep receiving until you’re ready to stop.
|
||||||
|
|
||||||
|
Use a trusted Wi-Fi network that lets your devices connect to each other. Transfers use an unencrypted local connection. Choose complete APK files compatible with your watch; installation depends on your watch’s permissions, available storage and Android’s security checks. App bundles and split APK sets are not supported.
|
||||||
|
|
||||||
|
Your watch. Your call.
|
||||||
|
|
||||||
|
## Required assets and Console work
|
||||||
|
|
||||||
|
- 512 × 512 Play icon using the parcel identity, meeting current Play icon specifications.
|
||||||
|
- 1024 × 500 feature graphic using the official tagline. No claim of universal compatibility or Google endorsement.
|
||||||
|
- Real square Wear screenshots of home, connection, receipt/review and success, with opaque backgrounds, no device frames, marketing overlays or circular masking. Export Play-compatible captures; raw circular emulator screenshots may contain masking and are development evidence only.
|
||||||
|
- Real developer/support contact and a hosted, public privacy-policy URL consistent with the bundled disclosure. No placeholder identities or links are supplied.
|
||||||
|
- Wear OS form-factor setup and test track; restricted installation and connectedDevice declarations plus demonstration video; app access instructions; Data safety, audience/ads and content rating.
|
||||||
|
- App access instructions should explain same trusted Wi-Fi, Start receiving, watch approval, a complete compatible APK and system confirmation. No account credentials are required. Supply a redistributable APK to reviewers and explain network/client-isolation prerequisites.
|
||||||
|
|
||||||
|
This is copy and an asset brief, not a completed store listing or Console submission. Recheck [current asset guidance](https://support.google.com/googleplay/android-developer/answer/9866151?hl=en) and [Wear quality requirements](https://developer.android.com/docs/quality-guidelines/wear-app-quality) at submission time.
|
||||||
+18
-12
@@ -15,30 +15,36 @@ See DEVELOPMENT.md for the commands and environment setup. Results are generated
|
|||||||
| Android-to-Wear transfer | Chrome on Android Emulator -> actual Wi-Fi HTTP listener on Wear OS Emulator -> verified signed APK waiting for watch review |
|
| Android-to-Wear transfer | Chrome on Android Emulator -> actual Wi-Fi HTTP listener on Wear OS Emulator -> verified signed APK waiting for watch review |
|
||||||
| Release | Clean debug/test/release builds, Android lint, dependency and merged-manifest inspection, fixture exclusion from consumer artifacts |
|
| Release | Clean debug/test/release builds, Android lint, dependency and merged-manifest inspection, fixture exclusion from consumer artifacts |
|
||||||
|
|
||||||
The install-consent test calls the same ApkInstaller used by the explicit watch action, waits for Android’s STATUS_PENDING_USER_ACTION and abandons the test session afterward. It does not grant permission or install through a shell command. Tests that require source approval use the emulator’s normal system setting; skipped assumptions are reported as incomplete validation by the test runner.
|
One install-consent test waits for Android’s STATUS_PENDING_USER_ACTION and abandons the session. A separate full-journey test taps the actual watch action and system confirmation through the UI. Neither grants source trust or installs through a shell command. Tests that require source approval use the emulator’s normal system setting; skipped assumptions are reported as incomplete validation by the test runner.
|
||||||
|
|
||||||
Browser UI fixtures exercise interactions independently; the separate Android Emulator test proves that the actual browser/XHR path reaches the actual watch listener. These are not substituted for one another. The receiving protocol continues to have no browser-triggered installation endpoint.
|
Browser UI fixtures exercise interactions independently; the separate Android Emulator test proves that the actual browser/XHR path reaches the actual watch listener. These are not substituted for one another. The receiving protocol continues to have no browser-triggered installation endpoint.
|
||||||
|
|
||||||
## Latest completed run
|
## Latest completed run
|
||||||
|
|
||||||
Receiving simplification validation date: October 15, 2026. No physical device was accessed.
|
Final product review: October 15, 2026. No physical device was accessed. Evidence is generated under `app/build/reports/validation` and `app/build/test-results`.
|
||||||
|
|
||||||
- **27 JVM tests passed**, with zero failures/errors.
|
| Environment | Verified coverage |
|
||||||
- **21 native tests passed** on the round Wear OS API 37 emulator, with no skipped assumptions. This includes the public installer’s required-consent callback, Wi-Fi loss/recovery without ending receiving, fixed-port reuse/collision behavior, IPv6, metadata rollback and released CPU wake locks after uploads.
|
| --- | --- |
|
||||||
- **Five round UI tests passed again** at 192 dp / 1.3x text: the initial receiving action stays visible, review/approval/error/success controls are reachable, connection details and transfer feedback work, and a decodable QR fits inside the circular bezel. Size, density and font scale were restored.
|
| JVM | **27 tests**, no failures/errors: streaming, digest, disk/ABI/SDK checks, HTTP framing/64-bit lengths, browser approval, progress and watch contrast. |
|
||||||
- **18 browser UI checks passed** on Chromium 140.0.7339.16 across four viewport widths and both themes, including connection recovery, keyboard focus, reduced motion and 200% zoom at an effective 320 px layout width, with zero JavaScript errors.
|
| ARM64 round Wear OS API 37 | **26 native tests**, no skipped assumptions: real signed socket uploads, watch-gated access, malformed/interrupted/storage failures, Wi-Fi loss/recovery, IPv6/fixed-port behavior, wake-lock release, metadata/removal rollback, old-review preservation, focused progress updates and offline privacy. |
|
||||||
- **Real Android Emulator Chrome 145.0.7632.218 uploaded signed APKs of 69,588,292 bytes and 270,914,884 bytes directly to the Wear OS Emulator over virtual Wi-Fi**, receiving READY review state. The larger APK contains a stored 256 MiB asset, exceeding the removed individual-entry and expanded-content caps. There were zero JavaScript errors and browser access was approved through the visible watch control. The test dismissed its package, ended receiving and removed its local debug forward.
|
| Public Android installer | The native suite taps Pakkit’s Install action, taps the real system Install/Update confirmation and receives successful installation with staged-file removal. Separate tests verify required consent, digest mutation and rejected stale/forged callbacks. The QA fixture remains installed on the emulator. No shell installer or source-permission grant is used for this path. |
|
||||||
- **Debug, test and release builds succeeded** for the debug app, instrumentation APK, unit tests, lint and optimized release AAB. Lint has zero errors; three remaining warnings are SDK/Gradle/library update notices, not unused code/resources.
|
| Ongoing activity | Official OngoingActivity data and an immutable return intent are present. Review status updates the actual notification; its Stop action closes receiving and removes the notification. Optional notification access is granted only on the emulator for this test. |
|
||||||
- Release inspection found exactly the three bundled web assets, no fixture APK/test payload, no package-visibility queries, one exported launcher and non-exported service/installer receiver. The release dependency graph contains ZXing Core, Kotlin stdlib and its annotations dependency.
|
| Small round Wear | **Eight UI tests** at 192 dp / 1.3x font: receiving and review actions, full decodable QR, progress/focus, approval-intent isolation and offline privacy. Settings restored afterward. |
|
||||||
- The unchanged Gradle distribution version is checksum-pinned to its official download. Release output is unsigned when signing inputs are absent; incomplete signing configuration fails clearly.
|
| Desktop Chromium 140 | **23 browser checks** across 320/390/768/1440 px and dark/light: keyless access/denial/retry, credential isolation, keyboard focus, theme persistence, reduced motion, 200% zoom, cancellation, state transitions, legal links, stalled headers/body recovery and a streamed 64 MiB upload. Zero JavaScript errors. API fixtures test the UI separately from real transport. |
|
||||||
|
| Android Emulator Chrome 145 → Wear Wi-Fi | **270,914,884-byte signed APK**, containing a stored 256 MiB asset, reaches READY through the real browser File/XHR path and real watch approval. No host-memory File buffer or production debug endpoint. |
|
||||||
|
| Native swipe/resume | Real left-to-right swipe dismisses the watch activity while receiving continues; reopening preserves the active address. |
|
||||||
|
| Background process recovery | After that receipt, the test backgrounds and kills Pakkit’s debug process using its own UID, reopens the application, finds the durable review, explicitly restarts receiving and reuses port 8787. Process death revokes browser access. This is not a long-duration Doze or battery benchmark. |
|
||||||
|
| Build/artifact | Debug app, instrumentation APK, JVM tests, Android lint and optimized release AAB pass. Lint: **zero errors**, four tool/library-update notices. Release checker verifies the merged manifest and exact five web/legal assets, no test APK or native `.so` payload, and records the bundle digest. Local AAB is **unsigned**. |
|
||||||
|
|
||||||
Ten watch product-state screenshots at each tested size, browser screenshots, detailed XML, text logs and browser summaries are generated under app/build/reports and app/build/test-results. They are not source assets or claims of universal hardware/browser support. No elapsed-time test certifies indefinite availability: long-duration screen-off/power behavior remains a hardware gate, and the receiver has no product expiry timer. Successful large uploads prove receipt/review, not successful installation of every large app.
|
The complete test commands and recovery option are in [development](DEVELOPMENT.md). Run emulator automation sequentially; simultaneous instrumentation and shell `uiautomator` can interfere with each other. Watch screenshots cover actual state layouts, including offline privacy; browser screenshots cover both themes. Raw circular screenshots are development evidence, not automatically Play-compatible listing artwork.
|
||||||
|
|
||||||
|
Only API 37 emulator images were available in this environment. Minimum API 31 runtime validation remains outstanding. No elapsed-time test certifies indefinite availability or measured power quality. Large receipt proves transfer/review; it does not prove every large app installs. The successful system install uses the small signed QA fixture.
|
||||||
|
|
||||||
## Hardware-specific release matrix
|
## Hardware-specific release matrix
|
||||||
|
|
||||||
- Fresh Google Play delivery, source approval and system confirmation on supported Galaxy Watch 7 and other firmware/regions, without preexisting source trust or developer setup. Include denied/revoked permission and cancellation.
|
- Fresh Google Play delivery, source approval and system confirmation on supported Galaxy Watch 7 and other firmware/regions, without preexisting source trust or developer setup. Include denied/revoked permission and cancellation.
|
||||||
- Transfers near actual free-storage capacity, prolonged receiving, interruption, repeated sessions, IP/network changes, guest/client-isolated networks, VPNs and browser local-network permission prompts.
|
- Transfers near actual free-storage capacity, prolonged receiving, interruption, repeated sessions, IP/network changes, guest/client-isolated networks, VPNs and browser local-network permission prompts.
|
||||||
- Long screen-off/Doze behavior, low battery/battery saver, charging transitions, memory/thermal behavior and measured battery consumption. Timed locks and bounded buffers alone are not measurements.
|
- Long screen-off/Doze behavior, low battery/battery saver, charging transitions, memory/thermal behavior and measured battery consumption. Scoped locks and bounded buffers alone are not measurements.
|
||||||
- Actual low storage and processor/SDK/package/update conflicts; system developer verification and managed-device restrictions. The OS is the final compatibility/security authority.
|
- Actual low storage and processor/SDK/package/update conflicts; system developer verification and managed-device restrictions. The OS is the final compatibility/security authority.
|
||||||
- TalkBack, rotary interaction, large font and physical small-round displays; camera scanning of QR on real displays under varied lighting.
|
- TalkBack, rotary interaction, large font and physical small-round displays; camera scanning of QR on real displays under varied lighting.
|
||||||
- Safari on iOS/macOS, Firefox, Edge/Windows, Linux browsers and Android browser variants. Emulator Chrome and desktop Chromium do not certify the whole browser matrix.
|
- Safari on iOS/macOS, Firefox, Edge/Windows, Linux browsers and Android browser variants. Emulator Chrome and desktop Chromium do not certify the whole browser matrix.
|
||||||
|
|||||||
@@ -4,12 +4,18 @@ zxing = "3.5.3"
|
|||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
androidxJunit = "1.3.0"
|
androidxJunit = "1.3.0"
|
||||||
androidxRunner = "1.7.0"
|
androidxRunner = "1.7.0"
|
||||||
|
wearOngoing = "1.1.0"
|
||||||
|
splashscreen = "1.2.0"
|
||||||
|
androidxCore = "1.17.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
androidx-core = { module = "androidx.core:core", version.ref = "androidxCore" }
|
||||||
zxing = { module = "com.google.zxing:core", version.ref = "zxing" }
|
zxing = { module = "com.google.zxing:core", version.ref = "zxing" }
|
||||||
junit = { module = "junit:junit", version.ref = "junit" }
|
junit = { module = "junit:junit", version.ref = "junit" }
|
||||||
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "androidxJunit" }
|
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "androidxJunit" }
|
||||||
androidx-runner = { module = "androidx.test:runner", version.ref = "androidxRunner" }
|
androidx-runner = { module = "androidx.test:runner", version.ref = "androidxRunner" }
|
||||||
|
wear-ongoing = { module = "androidx.wear:wear-ongoing", version.ref = "wearOngoing" }
|
||||||
|
splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "splashscreen" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Audit the built release bundle and its merged manifest; this is not Play approval."""
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
import zipfile
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
ANDROID = '{http://schemas.android.com/apk/res/android}'
|
||||||
|
bundle = ROOT / 'app/build/outputs/bundle/release/app-release.aab'
|
||||||
|
manifest = ROOT / 'app/build/intermediates/merged_manifests/release/processReleaseManifest/AndroidManifest.xml'
|
||||||
|
root = ET.parse(manifest).getroot()
|
||||||
|
app = root.find('application')
|
||||||
|
assert root.get('package') == 'meghdad.pakkit'
|
||||||
|
assert root.find('uses-sdk').get(ANDROID + 'targetSdkVersion') == '36'
|
||||||
|
assert root.find('uses-sdk').get(ANDROID + 'minSdkVersion') == '31'
|
||||||
|
assert app.get(ANDROID + 'allowBackup') == 'false'
|
||||||
|
assert app.get(ANDROID + 'debuggable', 'false') == 'false'
|
||||||
|
assert any(e.get(ANDROID + 'name') == 'android.hardware.type.watch' and e.get(ANDROID + 'required') == 'true' for e in root.findall('uses-feature'))
|
||||||
|
assert any(e.get(ANDROID + 'name') == 'com.google.android.wearable.standalone' and e.get(ANDROID + 'value') == 'true' for e in app.findall('meta-data'))
|
||||||
|
permissions = {e.get(ANDROID + 'name') for e in root.findall('uses-permission')}
|
||||||
|
expected = {'android.permission.' + p for p in ['REQUEST_INSTALL_PACKAGES', 'POST_NOTIFICATIONS', 'INTERNET', 'ACCESS_NETWORK_STATE', 'CHANGE_NETWORK_STATE', 'WAKE_LOCK', 'FOREGROUND_SERVICE', 'FOREGROUND_SERVICE_CONNECTED_DEVICE']}
|
||||||
|
assert permissions == expected | {'meghdad.pakkit.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'}, permissions
|
||||||
|
for component in app:
|
||||||
|
if component.tag not in {'activity', 'receiver', 'service', 'provider'}:
|
||||||
|
continue
|
||||||
|
name = component.get(ANDROID + 'name')
|
||||||
|
exported = component.get(ANDROID + 'exported') == 'true'
|
||||||
|
if name.endswith('.WatchActivity'):
|
||||||
|
assert exported and component.get(ANDROID + 'taskAffinity') == ''
|
||||||
|
elif name == 'androidx.profileinstaller.ProfileInstallReceiver':
|
||||||
|
assert exported and component.get(ANDROID + 'permission') == 'android.permission.DUMP'
|
||||||
|
else:
|
||||||
|
assert not exported, name
|
||||||
|
if component.tag == 'service':
|
||||||
|
assert component.get(ANDROID + 'foregroundServiceType') == 'connectedDevice'
|
||||||
|
assert root.find('queries') is None
|
||||||
|
with zipfile.ZipFile(bundle) as archive:
|
||||||
|
names = archive.namelist()
|
||||||
|
assets = sorted(n.removeprefix('base/assets/') for n in names if n.startswith('base/assets/') and not n.endswith('/'))
|
||||||
|
assert assets == ['legal/licenses.txt', 'legal/privacy.txt', 'web/app.js', 'web/index.html', 'web/style.css'], assets
|
||||||
|
for name in assets:
|
||||||
|
assert archive.read('base/assets/' + name) == (ROOT / 'app/src/main/assets' / name).read_bytes(), name
|
||||||
|
assert not any(n.endswith(('.apk', '.jks', '.keystore')) for n in names)
|
||||||
|
native = [n for n in names if n.endswith('.so')]
|
||||||
|
assert not native, 'Reassess 64-bit and 16 KB page support after adding native libraries'
|
||||||
|
signed = any(n.upper().startswith('META-INF/') and n.upper().endswith(('.RSA', '.EC', '.DSA')) for n in names)
|
||||||
|
lint_results = {}
|
||||||
|
for variant in ['debug', 'release']:
|
||||||
|
lint = ET.parse(ROOT / f'app/build/reports/lint-results-{variant}.xml').getroot()
|
||||||
|
issues = lint.findall('issue')
|
||||||
|
assert not any(i.get('severity') in {'Error', 'Fatal'} for i in issues)
|
||||||
|
lint_results[variant] = [i.get('id') for i in issues if i.get('severity') == 'Warning']
|
||||||
|
report = {
|
||||||
|
'bundle': str(bundle.relative_to(ROOT)),
|
||||||
|
'sha256': hashlib.sha256(bundle.read_bytes()).hexdigest(),
|
||||||
|
'bytes': bundle.stat().st_size,
|
||||||
|
'mergedManifestChecked': True,
|
||||||
|
'targetSdk': 36,
|
||||||
|
'minSdk': 31,
|
||||||
|
'assetsMatchSource': assets,
|
||||||
|
'nativeLibraries': native,
|
||||||
|
'signaturePresent': signed,
|
||||||
|
'signatureCryptographicallyVerified': False,
|
||||||
|
'lintErrors': 0,
|
||||||
|
'lintWarnings': lint_results,
|
||||||
|
'publicationGates': ['Verify upload signing and enroll in Play App Signing', 'Hosted privacy policy and real support contact', 'Store artwork and Console declarations', 'Hardware and browser compatibility matrix', 'Restricted-permission, foreground-service and Wear quality review', 'Confirm transport and Data safety handling against policy'],
|
||||||
|
}
|
||||||
|
output = ROOT / 'app/build/reports/validation/release-audit.json'
|
||||||
|
output.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
output.write_text(json.dumps(report, indent=2) + '\n')
|
||||||
|
print(json.dumps(report, indent=2))
|
||||||
@@ -13,8 +13,11 @@ parser.add_argument("--watch", required=True, help="Wear OS emulator serial, e.g
|
|||||||
parser.add_argument("--browser", help="Optional Android emulator serial with Chrome initialized")
|
parser.add_argument("--browser", help="Optional Android emulator serial with Chrome initialized")
|
||||||
parser.add_argument("--small", action="store_true", help="Run round UI tests at 192dp and 1.3x font size")
|
parser.add_argument("--small", action="store_true", help="Run round UI tests at 192dp and 1.3x font size")
|
||||||
parser.add_argument("--skip-build", action="store_true")
|
parser.add_argument("--skip-build", action="store_true")
|
||||||
|
parser.add_argument("--restart", action="store_true", help="After browser receipt, kill the background debug process and verify review recovery")
|
||||||
parser.add_argument("--large", action="store_true", help="Use app/build/qa/large-fixture.apk for the real browser upload")
|
parser.add_argument("--large", action="store_true", help="Use app/build/qa/large-fixture.apk for the real browser upload")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
if args.restart and not args.browser:
|
||||||
|
parser.error("--restart requires --browser.")
|
||||||
if args.browser == args.watch:
|
if args.browser == args.watch:
|
||||||
parser.error("Use distinct Wear OS and Android browser emulator serials.")
|
parser.error("Use distinct Wear OS and Android browser emulator serials.")
|
||||||
for serial in filter(None, [args.watch, args.browser]):
|
for serial in filter(None, [args.watch, args.browser]):
|
||||||
@@ -52,7 +55,7 @@ try:
|
|||||||
print(output, flush=True)
|
print(output, flush=True)
|
||||||
screenshots = report_dir / ("watch-product-small" if args.small else "watch-product")
|
screenshots = report_dir / ("watch-product-small" if args.small else "watch-product")
|
||||||
screenshots.mkdir(exist_ok=True)
|
screenshots.mkdir(exist_ok=True)
|
||||||
for name in ["home", "scan", "browser-approval", "sending", "checking", "ready", "installing", "confirm", "failed", "installed"]:
|
for name in ["home", "privacy", "scan", "browser-approval", "sending", "checking", "ready", "installing", "confirm", "failed", "installed"]:
|
||||||
image = adb(args.watch, "exec-out", "cat", f"/sdcard/Android/data/meghdad.pakkit/files/product-review/{name}.png")
|
image = adb(args.watch, "exec-out", "cat", f"/sdcard/Android/data/meghdad.pakkit/files/product-review/{name}.png")
|
||||||
(screenshots / f"{name}.png").write_bytes(image)
|
(screenshots / f"{name}.png").write_bytes(image)
|
||||||
|
|
||||||
@@ -96,8 +99,19 @@ if args.browser:
|
|||||||
if browser_test.poll() is None:
|
if browser_test.poll() is None:
|
||||||
browser_test.terminate()
|
browser_test.terminate()
|
||||||
browser_test.wait(timeout=10)
|
browser_test.wait(timeout=10)
|
||||||
|
if args.restart:
|
||||||
|
# Kill only this debug app, in the background, on the explicitly selected emulator.
|
||||||
|
adb(args.watch, "shell", "input", "keyevent", "KEYCODE_HOME")
|
||||||
|
pid = adb(args.watch, "shell", "pidof", "meghdad.pakkit").decode().strip()
|
||||||
|
if not pid.isdecimal():
|
||||||
|
raise RuntimeError("Expected one Pakkit debug process.")
|
||||||
|
adb(args.watch, "shell", "run-as", "meghdad.pakkit", "kill", "-9", pid)
|
||||||
adb(args.watch, "shell", "am", "start", "-W", "-n", "meghdad.pakkit/.ui.WatchActivity")
|
adb(args.watch, "shell", "am", "start", "-W", "-n", "meghdad.pakkit/.ui.WatchActivity")
|
||||||
tap_text(args.watch, "Remove file")
|
tap_text(args.watch, "Remove file")
|
||||||
|
if args.restart:
|
||||||
|
tap_text(args.watch, "Start receiving")
|
||||||
|
assert session_url(args.watch).endswith(":8787/")
|
||||||
|
(report_dir / "process-recovery.txt").write_text("PASS: background process killed after signed APK receipt; private review recovered, receiving required an explicit restart, fixed port reused.\n")
|
||||||
tap_text(args.watch, "Stop receiving")
|
tap_text(args.watch, "Stop receiving")
|
||||||
finally:
|
finally:
|
||||||
if args.large:
|
if args.large:
|
||||||
|
|||||||
@@ -13,13 +13,17 @@ let state = 'waiting',
|
|||||||
bytesReceived = 0,
|
bytesReceived = 0,
|
||||||
disconnected = false,
|
disconnected = false,
|
||||||
approved = true,
|
approved = true,
|
||||||
denied = false;
|
denied = false,
|
||||||
|
connectStalled = false,
|
||||||
|
statusBodyStalled = false;
|
||||||
const server = http.createServer(async (request, response) => {
|
const server = http.createServer(async (request, response) => {
|
||||||
response.setHeader('Cache-Control', 'no-store');
|
response.setHeader('Cache-Control', 'no-store');
|
||||||
const routes = {
|
const routes = {
|
||||||
'/': ['index.html', 'text/html'],
|
'/': ['index.html', 'text/html'],
|
||||||
'/app.js': ['app.js', 'text/javascript'],
|
'/app.js': ['app.js', 'text/javascript'],
|
||||||
'/style.css': ['style.css', 'text/css'],
|
'/style.css': ['style.css', 'text/css'],
|
||||||
|
'/privacy.txt': ['../legal/privacy.txt', 'text/plain'],
|
||||||
|
'/licenses.txt': ['../legal/licenses.txt', 'text/plain'],
|
||||||
};
|
};
|
||||||
if (routes[request.url]) {
|
if (routes[request.url]) {
|
||||||
const [file, type] = routes[request.url];
|
const [file, type] = routes[request.url];
|
||||||
@@ -29,6 +33,7 @@ const server = http.createServer(async (request, response) => {
|
|||||||
}
|
}
|
||||||
response.setHeader('Content-Type', 'application/json');
|
response.setHeader('Content-Type', 'application/json');
|
||||||
if (request.url === '/api/connect' || request.url === '/api/retry') {
|
if (request.url === '/api/connect' || request.url === '/api/retry') {
|
||||||
|
if (connectStalled) return;
|
||||||
if (request.url === '/api/retry') denied = false;
|
if (request.url === '/api/retry') denied = false;
|
||||||
response.end(
|
response.end(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
@@ -41,6 +46,10 @@ const server = http.createServer(async (request, response) => {
|
|||||||
} else if (!approved) {
|
} else if (!approved) {
|
||||||
response.writeHead(403).end(JSON.stringify({ connection: denied ? 'denied' : 'pending' }));
|
response.writeHead(403).end(JSON.stringify({ connection: denied ? 'denied' : 'pending' }));
|
||||||
} else if (request.url === '/api/status') {
|
} else if (request.url === '/api/status') {
|
||||||
|
if (statusBodyStalled) {
|
||||||
|
response.flushHeaders();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (disconnected) {
|
if (disconnected) {
|
||||||
response.writeHead(503).end('{}');
|
response.writeHead(503).end('{}');
|
||||||
return;
|
return;
|
||||||
@@ -106,6 +115,11 @@ const server = http.createServer(async (request, response) => {
|
|||||||
await page.close();
|
await page.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const privacy = await (await fetch(origin + '/privacy.txt')).text();
|
||||||
|
assert.match(privacy, /without encryption/);
|
||||||
|
assert.match(privacy, /private watch storage/);
|
||||||
|
assert.match(await (await fetch(origin + '/licenses.txt')).text(), /Apache License/);
|
||||||
|
checks++;
|
||||||
const context = await browser.newContext();
|
const context = await browser.newContext();
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
const errors = [];
|
const errors = [];
|
||||||
@@ -170,6 +184,11 @@ const server = http.createServer(async (request, response) => {
|
|||||||
failure = false;
|
failure = false;
|
||||||
await page.getByRole('button', { name: 'Send to watch' }).click();
|
await page.getByRole('button', { name: 'Send to watch' }).click();
|
||||||
await page.getByRole('heading', { name: 'Made it to your watch' }).waitFor();
|
await page.getByRole('heading', { name: 'Made it to your watch' }).waitFor();
|
||||||
|
assert.equal(
|
||||||
|
await page.locator('#result-title').evaluate((el) => el === document.activeElement),
|
||||||
|
true,
|
||||||
|
'Upload completion moves focus out of the hidden cancel control',
|
||||||
|
);
|
||||||
assert.equal(bytesReceived, file.buffer.length);
|
assert.equal(bytesReceived, file.buffer.length);
|
||||||
state = 'confirm';
|
state = 'confirm';
|
||||||
await page.getByRole('heading', { name: 'One tap closer' }).waitFor();
|
await page.getByRole('heading', { name: 'One tap closer' }).waitFor();
|
||||||
@@ -181,6 +200,14 @@ const server = http.createServer(async (request, response) => {
|
|||||||
checks++;
|
checks++;
|
||||||
state = 'installed';
|
state = 'installed';
|
||||||
await page.getByRole('heading', { name: 'Looks good on you.' }).waitFor();
|
await page.getByRole('heading', { name: 'Looks good on you.' }).waitFor();
|
||||||
|
await page.getByRole('button', { name: 'Send another app' }).focus();
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1700));
|
||||||
|
assert.equal(
|
||||||
|
await page.locator('#again').evaluate((el) => el === document.activeElement),
|
||||||
|
true,
|
||||||
|
'Status polling preserves the result action focus',
|
||||||
|
);
|
||||||
|
checks++;
|
||||||
await page.getByRole('button', { name: 'Send another app' }).click();
|
await page.getByRole('button', { name: 'Send another app' }).click();
|
||||||
await page.locator('#file').setInputFiles(file);
|
await page.locator('#file').setInputFiles(file);
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1700));
|
await new Promise((resolve) => setTimeout(resolve, 1700));
|
||||||
@@ -229,6 +256,26 @@ const server = http.createServer(async (request, response) => {
|
|||||||
);
|
);
|
||||||
checks++;
|
checks++;
|
||||||
|
|
||||||
|
const chosenTheme = await page.evaluate(() => document.documentElement.dataset.theme);
|
||||||
|
await page.reload();
|
||||||
|
await page.getByText('Connected to your watch', { exact: true }).waitFor();
|
||||||
|
assert.equal(await page.evaluate(() => document.documentElement.dataset.theme), chosenTheme);
|
||||||
|
checks++;
|
||||||
|
// A stalled connection request must not hold the polling loop forever.
|
||||||
|
await page.evaluate(() => localStorage.removeItem('pakkitAccess'));
|
||||||
|
connectStalled = true;
|
||||||
|
await page.reload();
|
||||||
|
await page.getByText('Watch out of reach', { exact: true }).waitFor({ timeout: 10000 });
|
||||||
|
connectStalled = false;
|
||||||
|
await page.getByText('Connected to your watch', { exact: true }).waitFor({ timeout: 10000 });
|
||||||
|
checks++;
|
||||||
|
|
||||||
|
statusBodyStalled = true;
|
||||||
|
await page.getByText('Watch out of reach', { exact: true }).waitFor({ timeout: 10000 });
|
||||||
|
statusBodyStalled = false;
|
||||||
|
await page.getByText('Connected to your watch', { exact: true }).waitFor({ timeout: 10000 });
|
||||||
|
checks++;
|
||||||
|
|
||||||
hold = false;
|
hold = false;
|
||||||
const largePath = path.join(reports, 'browser-large-fixture.apk');
|
const largePath = path.join(reports, 'browser-large-fixture.apk');
|
||||||
const descriptor = fs.openSync(largePath, 'w');
|
const descriptor = fs.openSync(largePath, 'w');
|
||||||
|
|||||||
Reference in new issue
Block a user