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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<!-- Transparent trampoline: notification tap / resume → PackageInstaller confirm UI. -->
<activity
android:name="com.ahmadkharfan.androidstudiolite.data.buildsystem.install.InstallConfirmActivity"
android:excludeFromRecents="true"
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />

<receiver
android:name="com.ahmadkharfan.androidstudiolite.data.buildsystem.install.InstallStatusReceiver"
android:exported="false" />

<!-- Elevates process priority while a remote build stream is active so backgrounding the
IDE is less likely to kill the client mid-build. specialUse: long-running user-initiated
build follow that fits no other FGS category. -->
<service
android:name="com.ahmadkharfan.androidstudiolite.feature.buildrun.RemoteBuildKeepAliveService"
android:exported="false"
android:foregroundServiceType="dataSync" />
</application>

</manifest>
8 changes: 4 additions & 4 deletions app/src/main/cpp/asl_pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void free_cstr_array(char **array) {
* given environment. Returns a two-element int[] { masterFd, pid }, or null on failure.
*/
JNIEXPORT jintArray JNICALL
Java_com_ahmadkharfan_androidstudiolite_data_local_pty_NativePty_nativeForkPty(
Java_com_ahmadkharfan_androidstudiolite_feature_terminal_pty_NativePty_nativeForkPty(
JNIEnv *env, jclass clazz,
jobjectArray jargv, jobjectArray jenvp, jstring jcwd, jint rows, jint cols) {
(void) clazz;
Expand Down Expand Up @@ -104,7 +104,7 @@ Java_com_ahmadkharfan_androidstudiolite_data_local_pty_NativePty_nativeForkPty(

/* Tell the kernel the terminal was resized so the child receives SIGWINCH and reflows. */
JNIEXPORT void JNICALL
Java_com_ahmadkharfan_androidstudiolite_data_local_pty_NativePty_nativeSetWinSize(
Java_com_ahmadkharfan_androidstudiolite_feature_terminal_pty_NativePty_nativeSetWinSize(
JNIEnv *env, jclass clazz, jint fd, jint rows, jint cols) {
(void) env;
(void) clazz;
Expand All @@ -117,7 +117,7 @@ Java_com_ahmadkharfan_androidstudiolite_data_local_pty_NativePty_nativeSetWinSiz

/* Reap the child; returns its exit code (or 128+signal), or -1 if it isn't our child / already reaped. */
JNIEXPORT jint JNICALL
Java_com_ahmadkharfan_androidstudiolite_data_local_pty_NativePty_nativeWaitFor(
Java_com_ahmadkharfan_androidstudiolite_feature_terminal_pty_NativePty_nativeWaitFor(
JNIEnv *env, jclass clazz, jint pid) {
(void) env;
(void) clazz;
Expand All @@ -134,7 +134,7 @@ Java_com_ahmadkharfan_androidstudiolite_data_local_pty_NativePty_nativeWaitFor(

/* Send SIGHUP then close the master, ending the session. */
JNIEXPORT void JNICALL
Java_com_ahmadkharfan_androidstudiolite_data_local_pty_NativePty_nativeDestroy(
Java_com_ahmadkharfan_androidstudiolite_feature_terminal_pty_NativePty_nativeDestroy(
JNIEnv *env, jclass clazz, jint fd, jint pid) {
(void) env;
(void) clazz;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import androidx.compose.ui.Modifier
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.ahmadkharfan.androidstudiolite.data.buildsystem.install.PendingInstallConfirmation
import com.ahmadkharfan.androidstudiolite.feature.buildrun.install.PendingInstallConfirmation
import com.ahmadkharfan.androidstudiolite.designsystem.theme.AslAppTheme
import com.ahmadkharfan.androidstudiolite.domain.model.AppPreferences
import com.ahmadkharfan.androidstudiolite.domain.model.AppThemeMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStore
import com.ahmadkharfan.androidstudiolite.data.buildsystem.install.ApkInstaller
import com.ahmadkharfan.androidstudiolite.feature.buildrun.install.ApkInstaller
import com.ahmadkharfan.androidstudiolite.data.buildsystem.signing.AndroidKeystoreManager
import com.ahmadkharfan.androidstudiolite.data.remote.ActiveBuildStore
import com.ahmadkharfan.androidstudiolite.domain.buildsystem.ActiveBuildRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStore
import com.ahmadkharfan.androidstudiolite.BuildConfig
import com.ahmadkharfan.androidstudiolite.core.environment.IdeEnvironmentPaths
import com.ahmadkharfan.androidstudiolite.data.local.EncryptedGitCredentialStore
import com.ahmadkharfan.androidstudiolite.data.local.JGitGitRepository
import com.ahmadkharfan.androidstudiolite.data.git.EncryptedGitCredentialStore
import com.ahmadkharfan.androidstudiolite.data.git.JGitGitRepository
import com.ahmadkharfan.androidstudiolite.data.remote.github.GitHubDeviceFlowAuthenticator
import com.ahmadkharfan.androidstudiolite.data.local.GitOperationCoordinator
import com.ahmadkharfan.androidstudiolite.data.local.DataStoreGitAuthorStore
import com.ahmadkharfan.androidstudiolite.data.git.GitOperationCoordinator
import com.ahmadkharfan.androidstudiolite.data.git.DataStoreGitAuthorStore
import com.ahmadkharfan.androidstudiolite.data.local.DefaultWorkspaceWriteGate
import com.ahmadkharfan.androidstudiolite.domain.repository.GitAuthorStore
import com.ahmadkharfan.androidstudiolite.domain.repository.GitCredentialStore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.ahmadkharfan.androidstudiolite.di
import com.ahmadkharfan.androidstudiolite.core.environment.IdeEnvironmentPaths
import com.ahmadkharfan.androidstudiolite.data.onboarding.AndroidOnboardingRepository
import com.ahmadkharfan.androidstudiolite.feature.onboarding.data.AndroidOnboardingRepository
import com.ahmadkharfan.androidstudiolite.domain.repository.OnboardingRepository
import com.ahmadkharfan.androidstudiolite.feature.createproject.CreateProjectViewModel
import com.ahmadkharfan.androidstudiolite.feature.editor.EditorViewModel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.ahmadkharfan.androidstudiolite.di

import com.ahmadkharfan.androidstudiolite.core.linux.LinuxBootstrapInstaller
import com.ahmadkharfan.androidstudiolite.core.linux.ProotEnvironment
import com.ahmadkharfan.androidstudiolite.data.local.pty.PtyTerminalRepository
import com.ahmadkharfan.androidstudiolite.feature.terminal.linux.LinuxBootstrapInstaller
import com.ahmadkharfan.androidstudiolite.feature.terminal.linux.ProotEnvironment
import com.ahmadkharfan.androidstudiolite.feature.terminal.pty.PtyTerminalRepository
import com.ahmadkharfan.androidstudiolite.feature.terminal.TerminalSessionManager
import org.koin.android.ext.koin.androidContext
import org.koin.core.module.Module
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/keepRules/rules.keep
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

# --- JNI / native PTY ---
-keepclasseswithmembernames class com.ahmadkharfan.androidstudiolite.data.local.pty.NativePty {
-keepclasseswithmembernames class com.ahmadkharfan.androidstudiolite.feature.terminal.pty.NativePty {
native <methods>;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.ahmadkharfan.androidstudiolite

import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test

/**
* The PTY package name is written down in three places that must agree: the Kotlin `NativePty`
* object, the JNI function names in `asl_pty.c`, and the R8 keep rule.
*
* A mismatch does not fail the build. It fails at runtime with `UnsatisfiedLinkError` the first time
* a terminal is opened, or — worse — only in a release build if the keep rule stops matching and R8
* strips the native methods. This test ties the C and keep-rule ends to the same package so a future
* rename cannot quietly break the binding.
*/
class NativePtyBindingTest {

private val moduleRoot = File("").absoluteFile
private val cSource = File(moduleRoot, "src/main/cpp/asl_pty.c")
private val keepRules = File(moduleRoot, "src/main/keepRules/rules.keep")

private val nativeMethods = listOf("nativeForkPty", "nativeSetWinSize", "nativeWaitFor", "nativeDestroy")

@Test
fun `the keep rule and the jni symbols name the same class`() {
assertTrue("expected $cSource to exist", cSource.isFile)
assertTrue("expected $keepRules to exist", keepRules.isFile)

val keptClass = Regex("""-keepclasseswithmembernames class ([\w.]*NativePty)""")
.find(keepRules.readText())
?.groupValues
?.get(1)
assertTrue("no NativePty keep rule found in $keepRules", keptClass != null)

val expectedPrefix = "Java_" + keptClass!!.replace(".", "_") + "_"
val actualPrefixes = Regex("""Java_[\w]*_NativePty_""").findAll(cSource.readText())
.map { it.value }
.toSet()

assertEquals(
"JNI symbols in asl_pty.c must match the class named by the R8 keep rule",
setOf(expectedPrefix),
actualPrefixes,
)
}

@Test
fun `every declared native method has a jni implementation`() {
val c = cSource.readText()
val missing = nativeMethods.filterNot { c.contains("_NativePty_$it") }
assertEquals("native methods without a JNI implementation", emptyList<String>(), missing)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import android.content.Context
import android.content.SharedPreferences
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.ActiveOperation
import com.ahmadkharfan.androidstudiolite.domain.model.GitOperationType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import java.net.URI

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitAuthorConfig
import com.ahmadkharfan.androidstudiolite.domain.repository.GitAuthorStore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitBranch
import com.ahmadkharfan.androidstudiolite.domain.model.GitException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitDiffHunk
import com.ahmadkharfan.androidstudiolite.domain.model.GitDiffKind
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitException
import org.eclipse.jgit.api.errors.TransportException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.data.local.DefaultWorkspaceWriteGate
import com.ahmadkharfan.androidstudiolite.data.local.FileChangeBus

import com.ahmadkharfan.androidstudiolite.domain.model.CloneProgress
import com.ahmadkharfan.androidstudiolite.domain.model.CloneOptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitBlameLine
import com.ahmadkharfan.androidstudiolite.domain.model.GitCommitChangeType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitDiffHunk
import com.ahmadkharfan.androidstudiolite.domain.model.GitDiffKind
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitConflictEntry
import com.ahmadkharfan.androidstudiolite.domain.model.GitException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitRemote
import com.ahmadkharfan.androidstudiolite.domain.model.GitUpstream
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitStash
import org.eclipse.jgit.api.Git
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitAheadBehind
import com.ahmadkharfan.androidstudiolite.domain.model.GitConflictInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitSubmodule
import com.ahmadkharfan.androidstudiolite.domain.model.GitSubmoduleStatus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitException
import com.ahmadkharfan.androidstudiolite.domain.model.GitSyncResult
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitAuthorConfig
import com.ahmadkharfan.androidstudiolite.domain.model.GitException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitOperationType
import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlin.time.Duration.Companion.milliseconds
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitException
import org.eclipse.jgit.api.errors.TransportException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitCredentials
import com.ahmadkharfan.androidstudiolite.domain.model.GitException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitCredentials
import com.ahmadkharfan.androidstudiolite.domain.model.GitIntegrationStatus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitCredentials
import com.ahmadkharfan.androidstudiolite.domain.model.PullMode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.CloneOptions
import com.ahmadkharfan.androidstudiolite.domain.model.GitCredentials
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitCredentials
import com.ahmadkharfan.androidstudiolite.domain.model.GitConflictStage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ahmadkharfan.androidstudiolite.data.local
package com.ahmadkharfan.androidstudiolite.data.git

import com.ahmadkharfan.androidstudiolite.domain.model.GitCredentials
import com.ahmadkharfan.androidstudiolite.domain.model.GitDiffHunk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.datastore.preferences.core.PreferenceDataStoreFactory
import androidx.datastore.preferences.core.Preferences
import com.ahmadkharfan.androidstudiolite.data.local.AndroidProjectRepository
import com.ahmadkharfan.androidstudiolite.data.local.FileChangeBus
import com.ahmadkharfan.androidstudiolite.data.local.JGitGitRepository
import com.ahmadkharfan.androidstudiolite.data.git.JGitGitRepository
import com.ahmadkharfan.androidstudiolite.domain.model.CloneOptions
import com.ahmadkharfan.androidstudiolite.domain.model.GitCredentials
import com.ahmadkharfan.androidstudiolite.domain.model.Project
Expand Down
23 changes: 23 additions & 0 deletions feature/buildrun/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,27 @@
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />

<application>

<!-- Transparent trampoline: notification tap / resume → PackageInstaller confirm UI. -->
<activity
android:name="com.ahmadkharfan.androidstudiolite.feature.buildrun.install.InstallConfirmActivity"
android:excludeFromRecents="true"
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />

<receiver
android:name="com.ahmadkharfan.androidstudiolite.feature.buildrun.install.InstallStatusReceiver"
android:exported="false" />

<!-- Elevates process priority while a remote build stream is active so backgrounding the
IDE is less likely to kill the client mid-build. specialUse: long-running user-initiated
build follow that fits no other FGS category. -->
<service
android:name="com.ahmadkharfan.androidstudiolite.feature.buildrun.RemoteBuildKeepAliveService"
android:exported="false"
android:foregroundServiceType="dataSync" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.ahmadkharfan.androidstudiolite.feature.buildrun

import com.ahmadkharfan.androidstudiolite.data.buildsystem.install.InstallEvent
import com.ahmadkharfan.androidstudiolite.data.buildsystem.install.UninstallEvent
import com.ahmadkharfan.androidstudiolite.feature.buildrun.install.InstallEvent
import com.ahmadkharfan.androidstudiolite.feature.buildrun.install.UninstallEvent
import com.ahmadkharfan.androidstudiolite.domain.buildsystem.GradleProjectInspector
import com.ahmadkharfan.androidstudiolite.domain.buildsystem.BuildEvent
import com.ahmadkharfan.androidstudiolite.domain.buildsystem.BuildRequest
Expand Down
Loading
Loading