Tag Archives: android system

The upgrade of Ubuntu results in an error in the compilation of Android Jack [Two Method to Solve]

Error log:

Ensuring Jack server is installed and started
FAILED: setup-jack-server
/bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar  2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 ||
 exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.32.CANDIDATE.jar 4.32.CANDIDATE || exit 47 )"
Jack server already installed in "~/.jack-server"
Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp ~/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log
SSL error when connecting to the Jack server. Try 'jack-diagnose'
SSL error when connecting to the Jack server. Try 'jack-diagnose'
ninja: build stopped: subcommand failed.
10:11:50 ninja failed with: exit status 1

Problems caused by JDK automatic upgrade

Method 1:

Delete tlsv1 and tlsv1.1 under jdk.tls.disabledalgorithms in/etc/java-8-openjdk/security/java.security

Then install Jack again  ( Jack needs to modify the port number after unloading and reloading)

It needs to be implemented
mmm   prebuilts/sdk/tools/
jack-admin   uninstall-server  & amp;& amp;   jack-admin   kill-server
make   setup-jack-server

Method 2:


diff --git a/prebuilts/sdk/tools/jack b/prebuilts/sdk/tools/jack
index ae291f4..16eb180 100755
--- a/prebuilts/sdk/tools/jack
+++ b/prebuilts/sdk/tools/jack
@@ -134,7 +134,7 @@ HTTP_CODE=$(curl -f $JACK_EXTRA_CURL_OPTIONS \
      -F "version=$JACK_VERSION;type=application/vnd.jack.select-exact;version=1" \
      -F "pwd=$JACK_PWD;type=text/plain$CHARSET_ARGUMENT" \
      --noproxy ${SERVER_HOST} \
-     https://${SERVER_HOST}:$SERVER_PORT_SERVICE/jack \
+     http://${SERVER_HOST}:$SERVER_PORT_SERVICE/jack \
      )
 
 CURL_CODE=$?
diff --git a/prebuilts/sdk/tools/jack-admin b/prebuilts/sdk/tools/jack-admin
index ee193fc..c964bc5 100755
--- a/prebuilts/sdk/tools/jack-admin
+++ b/prebuilts/sdk/tools/jack-admin
@@ -136,7 +136,7 @@ updateProgram () {
        -F "jar=@$2;type=application/octet-stream" \
        -F "force=$FORCE_INSTALLATION;type=text/plain$CHARSET_ARGUMENT" \
        --noproxy ${SERVER_HOST} \
-       https://${SERVER_HOST}:$SERVER_PORT_ADMIN/$1 \
+       http://${SERVER_HOST}:$SERVER_PORT_ADMIN/$1 \
        )
   handleHttpErrors $?$HTTP_CODE
 
@@ -159,7 +159,7 @@ isServerRunning () {
          -X GET \
          -H "Accept: text/plain$CHARSET_ARGUMENT" \
          --noproxy ${SERVER_HOST} \
-         https://${SERVER_HOST}:$SERVER_PORT_ADMIN/server \
+         http://${SERVER_HOST}:$SERVER_PORT_ADMIN/server \
          )
     CURL_CODE=$?
     if [ $CURL_CODE -eq 0 ]; then
@@ -196,7 +196,7 @@ waitServerStarted () {
          -X GET \
          -H "Accept: text/plain$CHARSET_ARGUMENT" \
          --noproxy ${SERVER_HOST} \
-         https://${SERVER_HOST}:$SERVER_PORT_ADMIN/server \
+         http://${SERVER_HOST}:$SERVER_PORT_ADMIN/server \
          )
     CURL_CODE=$?
     if [ $CURL_CODE -eq 7 ] || [ $CURL_CODE -eq 35 ] || [ $CURL_CODE -eq 58 ] || [ $CURL_CODE -eq 60 ] || [ $CURL_CODE -eq 77 ]; then
@@ -226,7 +226,7 @@ listProgramVersion () {
        -X GET \
        -H "Accept: text/plain$CHARSET_ARGUMENT" \
        --noproxy ${SERVER_HOST} \
-       https://${SERVER_HOST}:$SERVER_PORT_ADMIN/$1 \
+       http://${SERVER_HOST}:$SERVER_PORT_ADMIN/$1 \
        )
   handleHttpErrors $?$HTTP_CODE
   exec 3>&-
@@ -336,7 +336,7 @@ case $COMMAND in
              --data "$4" \
              -H "Content-Type:application/vnd.jack.select-exact;version=1" \
              --noproxy ${SERVER_HOST} \
-             https://${SERVER_HOST}:$SERVER_PORT_ADMIN/$2 \
+             http://${SERVER_HOST}:$SERVER_PORT_ADMIN/$2 \
              )
         CURL_CODE=$?
         if [ $CURL_CODE -eq 22 ]; then
@@ -365,7 +365,7 @@ case $COMMAND in
          --no-buffer --write-out '%{http_code}' --silent --connect-timeout $JACK_CONNECTION_TIMEOUT \
          -X POST \
          --noproxy ${SERVER_HOST} \
-         https://${SERVER_HOST}:$SERVER_PORT_ADMIN/server/stop \
+         http://${SERVER_HOST}:$SERVER_PORT_ADMIN/server/stop \
          )
     handleHttpErrors $?$HTTP_CODE ;;
 
@@ -382,7 +382,7 @@ case $COMMAND in
          -X GET \
          -H "Accept: text/plain$CHARSET_ARGUMENT" \
          --noproxy ${SERVER_HOST} \
-         https://${SERVER_HOST}:$SERVER_PORT_ADMIN/stat \
+         http://${SERVER_HOST}:$SERVER_PORT_ADMIN/stat \
          )
     handleHttpErrors $?$HTTP_CODE
     exec 3>&- ;;
@@ -398,7 +398,7 @@ case $COMMAND in
          -X GET \
          -H "Accept: text/plain$CHARSET_ARGUMENT" \
         --noproxy ${SERVER_HOST} \
-         https://${SERVER_HOST}:$SERVER_PORT_ADMIN/launcher/log \
+         http://${SERVER_HOST}:$SERVER_PORT_ADMIN/launcher/log \
          )
     handleHttpErrors $?$HTTP_CODE
     exec 3>&- ;;
@@ -500,7 +500,7 @@ case $COMMAND in
          --form "limit=$LIMIT;type=text/plain$CHARSET_ARGUMENT" \
          --form "count=$COUNT;type=text/plain$CHARSET_ARGUMENT" \
          --noproxy ${SERVER_HOST} \
-         https://${SERVER_HOST}:$SERVER_PORT_ADMIN/launcher/log/level \
+         http://${SERVER_HOST}:$SERVER_PORT_ADMIN/launcher/log/level \
          )
     handleHttpErrors $?$HTTP_CODE ;;
 
@@ -515,7 +515,7 @@ case $COMMAND in
          --no-buffer --write-out '%{http_code}' --silent --connect-timeout $JACK_CONNECTION_TIMEOUT \
          -X POST \
          --noproxy ${SERVER_HOST} \
-         https://${SERVER_HOST}:$SERVER_PORT_ADMIN/gc \
+         http://${SERVER_HOST}:$SERVER_PORT_ADMIN/gc \
          )
     handleHttpErrors $?$HTTP_CODE ;;
 
diff --git a/prebuilts/sdk/tools/jack-server-3.0.ENGINEERING.jar b/prebuilts/sdk/tools/jack-server-3.0.ENGINEERING.jar
new file mode 100755
index 0000000..551073f
Binary files /dev/null and b/prebuilts/sdk/tools/jack-server-3.0.ENGINEERING.jar differ
diff --git a/prebuilts/sdk/tools/jack_server_setup.mk b/prebuilts/sdk/tools/jack_server_setup.mk
old mode 100644
new mode 100755
index fd6a134..a2b6714
--- a/prebuilts/sdk/tools/jack_server_setup.mk
+++ b/prebuilts/sdk/tools/jack_server_setup.mk
@@ -15,7 +15,8 @@
 #
 LOCAL_PATH:= $(call my-dir)
 
-jack_server_version := 4.8.ALPHA
+#jack_server_version := 4.8.ALPHA
+jack_server_version := 3.0.ENGINEERING
 jack_server_jar := $(LOCAL_PATH)/jack-server-$(jack_server_version).jar
 
 

Then reinstall jack (you need to change the port number after jack uninstall and reinstall)
You need to execute
mmm prebuilts/sdk/tools/
jack-admin uninstall-server && jack-admin kill-server
make setup-jack-server

Refer:
https://stackoverflow.com/questions/67330554/is-openjdk-upgrading-to-8u292-break-my-aosp-build-system

Encryption unsuccessful, need to factory reset or crash after android restarts several times

This reality has been seen in previous projects that did not have batteries, but the one that did not have a battery power outage and had data being written to EMMC, whereas reboot was supposed to shut down or pause all threads to make sure that no EMMC operation was written. Depressing.
There is no way to appear, it appears, take a look at what Android Reboot does, baidu, there are a lot of, post the process out:

framework 
./base/core/java/com/android/internal/app/ShutdownThread.java
/**
     * Do not call this directly. Use {@link #reboot(Context, String, boolean)}
     * or {@link #shutdown(Context, boolean)} instead.
     *
     * @param reboot true to reboot or false to shutdown
     * @param reason reason for reboot
     */
    public static void rebootOrShutdown(boolean reboot, String reason) {
        if (reboot) {
            Log.i(TAG, "Rebooting, reason: " + reason);
            try {
                Power.reboot(reason);
            } catch (Exception e) {
                Log.e(TAG, "Reboot failed, will attempt shutdown instead", e);
            }
        } else if (SHUTDOWN_VIBRATE_MS > 0) {
            // vibrate before shutting down
            Vibrator vibrator = new Vibrator();
            try {
                vibrator.vibrate(SHUTDOWN_VIBRATE_MS);
            } catch (Exception e) {
                // Failure to vibrate shouldn't interrupt shutdown.  Just log it.
                Log.w(TAG, "Failed to vibrate during shutdown.", e);
            }

            // vibrator is asynchronous so we need to wait to avoid shutting down too soon.
            try {
                Thread.sleep(SHUTDOWN_VIBRATE_MS);
            } catch (InterruptedException unused) {
            }
        }

        // Shutdown power
        Log.i(TAG, "Performing low-level shutdown...");
        Power.shutdown();
    }




./base/core/jni/android_os_Power.cpp 
static void android_os_Power_shutdown(JNIEnv *env, jobject clazz)
{
    android_reboot(ANDROID_RB_POWEROFF, 0, 0);
}

extern int go_recovery(void);

static void android_os_Power_reboot(JNIEnv *env, jobject clazz, jstring reason)
{
    if (reason == NULL) {
        android_reboot(ANDROID_RB_RESTART, 0, 0);
    } else {
        const char *chars = env->GetStringUTFChars(reason, NULL);
        //android_reboot(ANDROID_RB_RESTART2, 0, (char *) chars);
        go_recovery();
        android_reboot(ANDROID_RB_RESTART, 0, 0);
        env->ReleaseStringUTFChars(reason, chars);  // In case it fails.
    }
    jniThrowIOException(env, errno);
}

ANDOID_ROOT\system\core\libcutils\android_reboot.c
int android_reboot(int cmd, int flags, char *arg)
{
    int ret;

    if (!(flags & ANDROID_RB_FLAG_NO_SYNC))
        sync();

    if (!(flags & ANDROID_RB_FLAG_NO_REMOUNT_RO))
        remount_ro();

    switch (cmd) {
        case ANDROID_RB_RESTART:
            ret = reboot(RB_AUTOBOOT);
            break;

        case ANDROID_RB_POWEROFF:
            ret = reboot(RB_POWER_OFF);
            break;

        case ANDROID_RB_RESTART2:
            ret = __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
                           LINUX_REBOOT_CMD_RESTART2, arg);
            break;

        default:
            ret = -1;
    }

    return ret;
}

android4.0/frameworks/base/core/jni/misc_rw.cpp
/* force the next boot to recovery */
int go_recovery(void){
	
	LOGE("go_recovery  =================\n");
	struct bootloader_message boot, temp;

	memset(&boot, 0, sizeof(boot));
	strcpy(boot.command, "boot-recovery");
	if (set_bootloader_message_block(&boot, MISC_DEVICE) )
		return -1;

	//read for compare
	memset(&temp, 0, sizeof(temp));
	if (get_bootloader_message_block(&temp, MISC_DEVICE))
		return -1;

	if( memcmp(&boot, &temp, sizeof(boot)) )
		return -1;
	LOGE("go_recovery  ++++++++++++++++++++++\n");
	return 0;

}

as you can see from above, the system is mount readonly before reboot:

  remount_ro();

So why is there a problem?The problem seems to be remount_ro(); The inside. Look at the code inside

static void remount_ro(void)
{
    int fd, cnt = 0;

    /* Trigger the remount of the filesystems as read-only,
     * which also marks them clean.
     */
    fd = open("/proc/sysrq-trigger", O_WRONLY);
    if (fd < 0) {
        return;
    }
    write(fd, "u", 1);
    close(fd);


    /* Now poll /proc/mounts till it's done */
    while (!remount_ro_done() && (cnt < 50)) {
        usleep(100000);
        cnt++;
    }

    return;
}

 

/proc/sysrq-trigger

This is a read-only node that can restart the system, remount, and so on, but it’s asynchronous, so there’s a check and wait, it’s probably not long enough to wait (5S), let’s try it out for a minute.