Skip to content

Commit 51c67ac

Browse files
committed
Update signal 9 page
1 parent ba43ec7 commit 51c67ac

File tree

8 files changed

+164
-113
lines changed

8 files changed

+164
-113
lines changed

android/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ android {
7373
buildFeatures {
7474
aidl true
7575
dataBinding true
76+
viewBinding true
7677
buildConfig true
7778
}
7879

android/app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
<category android:name="android.intent.category.LAUNCHER"/>
3737
</intent-filter>
3838
</activity>
39-
<activity android:name="com.example.tiny_computer.Signal9Activity" />
39+
<activity
40+
android:name=".Signal9Activity"
41+
android:exported="true"
42+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
4043
<provider
4144
android:name="com.example.tiny_computer.filepicker.TinyDocumentsProvider"
4245
android:authorities="com.example.tiny_computer.documents"
Lines changed: 45 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,62 @@
11
package com.example.tiny_computer
22

3-
import android.content.ClipData
4-
import android.content.ClipboardManager
5-
import android.content.Context
63
import android.content.Intent
7-
import android.graphics.Color
84
import android.net.Uri
5+
import android.os.Build
96
import android.os.Bundle
10-
import android.view.Gravity
11-
import android.view.View
12-
import android.widget.Button
13-
import android.widget.ScrollView
14-
import android.widget.TextView
15-
import android.widget.Toast
16-
import android.widget.LinearLayout
177
import androidx.appcompat.app.AppCompatActivity
18-
import androidx.core.content.ContextCompat.startActivity
8+
import androidx.core.content.ContextCompat
9+
import androidx.core.view.isVisible
10+
import com.example.tiny_computer.databinding.ActivitySignal9Binding
1911

2012
class Signal9Activity : AppCompatActivity() {
2113

22-
private val helperLink = "https://www.vmos.cn/zhushou.htm"
23-
private val helperLink2 = "https://www.cnblogs.com/yejiuluo/articles/18271904"
14+
private lateinit var binding: ActivitySignal9Binding
2415

2516
override fun onCreate(savedInstanceState: Bundle?) {
2617
super.onCreate(savedInstanceState)
18+
binding = ActivitySignal9Binding.inflate(layoutInflater)
19+
setContentView(binding.root)
20+
21+
// 设置状态栏和导航栏颜色匹配蓝屏背景
22+
window.statusBarColor = ContextCompat.getColor(this, R.color.tc_s9a_blue_screen_blue)
23+
window.navigationBarColor = ContextCompat.getColor(this, R.color.tc_s9a_blue_screen_blue)
24+
25+
setupContent()
26+
}
2727

28-
val rootLayout = LinearLayout(this).apply {
29-
layoutParams = LinearLayout.LayoutParams(
30-
LinearLayout.LayoutParams.MATCH_PARENT,
31-
LinearLayout.LayoutParams.WRAP_CONTENT
32-
)
33-
gravity = Gravity.CENTER
34-
orientation = LinearLayout.VERTICAL
35-
setPadding(16, 16, 16, 16)
36-
setBackgroundColor(Color.parseColor("#4A148C"))
37-
}
38-
39-
val scrollView = ScrollView(this).apply {
40-
layoutParams = LinearLayout.LayoutParams(
41-
LinearLayout.LayoutParams.MATCH_PARENT,
42-
LinearLayout.LayoutParams.MATCH_PARENT
43-
)
44-
}
45-
46-
val fullScreen = LinearLayout(this).apply {
47-
layoutParams = LinearLayout.LayoutParams(
48-
LinearLayout.LayoutParams.MATCH_PARENT,
49-
LinearLayout.LayoutParams.MATCH_PARENT
50-
)
51-
orientation = LinearLayout.VERTICAL
52-
setBackgroundColor(Color.parseColor("#4A148C"))
53-
}
54-
55-
val text1 = TextView(this).apply {
56-
text = ":(\n发生了什么?"
57-
textSize = 32f
58-
setTextColor(Color.WHITE)
59-
textAlignment = View.TEXT_ALIGNMENT_CENTER
60-
}
61-
62-
val text2 = TextView(this).apply {
63-
text = "终端异常退出, 返回错误码9\n此错误通常是高版本安卓系统(12+)限制进程造成的, \n可以使用以下工具修复:"
64-
textSize = 16f
65-
setTextColor(Color.WHITE)
66-
textAlignment = View.TEXT_ALIGNMENT_CENTER
67-
setPadding(0, 16, 0, 0)
68-
}
69-
70-
val helperLinkText = TextView(this).apply {
71-
text = helperLink
72-
textSize = 16f
73-
setTextColor(Color.WHITE)
74-
textAlignment = View.TEXT_ALIGNMENT_CENTER
75-
setPadding(0, 16, 0, 0)
76-
setOnClickListener { copyToClipboard(helperLink) }
77-
}
78-
79-
val copyHintText = TextView(this).apply {
80-
text = "(复制链接到浏览器查看)"
81-
textSize = 16f
82-
setTextColor(Color.WHITE)
83-
textAlignment = View.TEXT_ALIGNMENT_CENTER
84-
setPadding(0, 8, 0, 0)
85-
}
86-
87-
val copyButton = Button(this).apply {
88-
text = "复制"
89-
textSize = 16f
90-
setOnClickListener { copyToClipboard(helperLink) }
91-
}
92-
93-
val tutorialText = TextView(this).apply {
94-
text = "如果你的设备版本大于等于安卓14,可以在开发者选项里开启“停止限制子进程”选项即可,无需额外修复。\n\n如果不能解决请参考此教程: "
95-
textSize = 16f
96-
setTextColor(Color.WHITE)
97-
textAlignment = View.TEXT_ALIGNMENT_CENTER
98-
setPadding(0, 16, 0, 0)
99-
}
100-
101-
val viewButton = Button(this).apply {
102-
text = "查看"
103-
textSize = 16f
104-
setOnClickListener { copyToClipboard(helperLink2) }
28+
private fun setupContent() {
29+
// 设置错误信息
30+
binding.errorDetails.text = getString(R.string.tc_s9a_error_message)
31+
32+
// 根据Android版本显示不同的解决方案
33+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
34+
// Android 14以下版本
35+
binding.preAndroid14Layout.isVisible = true
36+
binding.solutionIntro.text = getString(R.string.tc_s9a_solution_intro)
37+
binding.solutionAlternative.text = getString(R.string.tc_s9a_solution_alternative)
38+
binding.toolButton.text = getString(R.string.tc_s9a_tool_button)
39+
binding.tutorialButton.text = getString(R.string.tc_s9a_tutorial_button)
40+
41+
binding.toolButton.setOnClickListener {
42+
openBrowserLink("https://www.vmos.cn/zhushou.htm")
43+
}
44+
45+
binding.tutorialButton.setOnClickListener {
46+
openBrowserLink("https://gitee.com/caten/tc-hints/blob/master/pool/signal9fix.md")
47+
}
48+
} else {
49+
// Android 14及以上版本
50+
binding.solutionAndroid14.isVisible = true
51+
binding.solutionAndroid14.text = getString(R.string.tc_s9a_solution_android14)
10552
}
106-
107-
rootLayout.addView(text1)
108-
rootLayout.addView(text2)
109-
rootLayout.addView(helperLinkText)
110-
rootLayout.addView(copyHintText)
111-
rootLayout.addView(copyButton)
112-
rootLayout.addView(tutorialText)
113-
rootLayout.addView(viewButton)
114-
115-
scrollView.addView(rootLayout)
116-
fullScreen.addView(scrollView)
117-
118-
setContentView(fullScreen)
11953
}
12054

121-
private fun copyToClipboard(text: String) {
122-
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
123-
val clip = ClipData.newPlainText("Copied Text", text)
124-
clipboard.setPrimaryClip(clip)
125-
Toast.makeText(this, "已复制", Toast.LENGTH_SHORT).show()
126-
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(text))
127-
startActivity(this, intent, null)
55+
private fun openBrowserLink(url: String) {
56+
if (url.isNotEmpty()) {
57+
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
58+
startActivity(intent)
59+
}
60+
// 如果URL为空,则不执行任何操作(等待后续补充链接)
12861
}
129-
}
62+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:background="@color/tc_s9a_blue_screen_blue"
7+
tools:context=".Signal9Activity">
8+
9+
<LinearLayout
10+
android:layout_width="match_parent"
11+
android:layout_height="wrap_content"
12+
android:orientation="vertical"
13+
android:padding="20dp">
14+
15+
<TextView
16+
android:id="@+id/kaomoji_text"
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:text="@string/tc_s9a_kaomoji"
20+
android:textColor="@color/tc_s9a_white"
21+
android:textSize="96sp"
22+
android:textStyle="bold" />
23+
24+
<TextView
25+
android:id="@+id/error_details"
26+
android:layout_width="match_parent"
27+
android:layout_height="wrap_content"
28+
android:layout_marginTop="16dp"
29+
android:textColor="@color/tc_s9a_white"
30+
android:textSize="16sp" />
31+
32+
<!-- Android 14以下版本的内容 -->
33+
<LinearLayout
34+
android:id="@+id/pre_android14_layout"
35+
android:layout_width="match_parent"
36+
android:layout_height="wrap_content"
37+
android:orientation="vertical"
38+
android:visibility="gone">
39+
40+
<TextView
41+
android:id="@+id/solution_intro"
42+
android:layout_width="match_parent"
43+
android:layout_height="wrap_content"
44+
android:layout_marginTop="24dp"
45+
android:textColor="@color/tc_s9a_white"
46+
android:textSize="16sp" />
47+
48+
<Button
49+
android:id="@+id/tool_button"
50+
android:layout_width="wrap_content"
51+
android:layout_height="wrap_content"
52+
android:layout_marginTop="16dp"
53+
android:backgroundTint="@color/tc_s9a_white"
54+
android:textColor="@color/tc_s9a_blue_screen_blue" />
55+
56+
<TextView
57+
android:id="@+id/solution_alternative"
58+
android:layout_width="match_parent"
59+
android:layout_height="wrap_content"
60+
android:layout_marginTop="24dp"
61+
android:textColor="@color/tc_s9a_white"
62+
android:textSize="16sp" />
63+
64+
<Button
65+
android:id="@+id/tutorial_button"
66+
android:layout_width="wrap_content"
67+
android:layout_height="wrap_content"
68+
android:layout_marginTop="16dp"
69+
android:backgroundTint="@color/tc_s9a_white"
70+
android:textColor="@color/tc_s9a_blue_screen_blue" />
71+
72+
</LinearLayout>
73+
74+
<!-- Android 14及以上版本的内容 -->
75+
<TextView
76+
android:id="@+id/solution_android14"
77+
android:layout_width="match_parent"
78+
android:layout_height="wrap_content"
79+
android:layout_marginTop="24dp"
80+
android:textColor="@color/tc_s9a_white"
81+
android:textSize="16sp"
82+
android:visibility="gone" />
83+
84+
</LinearLayout>
85+
</ScrollView>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<string name="tc_app_name">小小电脑</string>
4+
5+
<string name="tc_s9a_error_message">终端异常终止,返回错误码9。此错误是安卓12+系统限制子进程数量造成的,需要手动关闭限制。</string>
6+
<string name="tc_s9a_kaomoji">:(</string>
7+
<string name="tc_s9a_solution_intro">可以使用以下工具修复:</string>
8+
<string name="tc_s9a_solution_alternative">如果以上工具无法修复,或者设备为鸿蒙设备,请按照以下教程解决(需要电脑和数据线):</string>
9+
<string name="tc_s9a_tool_button">修复工具</string>
10+
<string name="tc_s9a_tutorial_button">教程链接</string>
11+
<string name="tc_s9a_solution_android14">请在设置应用中启用开发者选项(通常步骤是找到关于设备->系统版本->连续点击系统版本5次),然后在开发者选项中找到\"停止限制子进程\",打开开关即可。不同机型开启开发者选项的步骤可能略有不同,具体方法可在网络搜索。</string>
412
</resources>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<string name="tc_app_name">小小電腦</string>
4+
5+
<string name="tc_s9a_error_message">終端異常終止,返回錯誤碼9。此錯誤是安卓12+系統限制子進程數量造成的,需要手動關閉限制。</string>
6+
<string name="tc_s9a_kaomoji">:(</string>
7+
<string name="tc_s9a_solution_intro">可以使用以下工具修復:</string>
8+
<string name="tc_s9a_solution_alternative">如果以上工具無法修復,或者設備為鴻蒙設備,請按照以下教程解決(需要電腦和數據線):</string>
9+
<string name="tc_s9a_tool_button">修復工具</string>
10+
<string name="tc_s9a_tutorial_button">教程鏈接</string>
11+
<string name="tc_s9a_solution_android14">請在設置應用中啟用開發者選項(通常步驟是找到關於設備->系統版本->連續點擊系統版本5次),然後在開發者選項中找到\"停止限制子進程\",打開開關即可。不同機型開啟開發者選項的步驟可能略有不同,具體方法可在網絡搜尋。</string>
412
</resources>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="tc_s9a_blue_screen_blue">#FF6F43C0</color>
4+
<color name="tc_s9a_white">#FFFFFFFF</color>
5+
</resources>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<string name="tc_app_name">Tiny Computer</string>
4+
5+
<string name="tc_s9a_error_message">Terminal terminated abnormally with error code 9. This error is caused by Android 12+ system limiting the number of child processes and requires manual removal of the restriction.</string>
6+
<string name="tc_s9a_kaomoji">:(</string>
7+
<string name="tc_s9a_solution_intro">You can use the following tool to fix:</string>
8+
<string name="tc_s9a_solution_alternative">If the above tool cannot fix the issue, or if the device is a Harmony device, please follow the tutorial below (requires a computer and data cable):</string>
9+
<string name="tc_s9a_tool_button">Repair Tool</string>
10+
<string name="tc_s9a_tutorial_button">Tutorial Link</string>
11+
<string name="tc_s9a_solution_android14">Please enable developer options in the Settings app (usually by going to About device -> System version -> tap System version 5 times continuously), then find "Stop restricting child processes" in developer options and turn on the switch. The steps to enable Developer Options may vary slightly depending on the device model. For specific methods, you can search online.</string>
412
</resources>

0 commit comments

Comments
 (0)