精简应用权限申请,移除不必要的前台服务。

This commit is contained in:
2026-03-17 02:36:26 +08:00
parent e0ac8f1f60
commit 168155f0db
3 changed files with 6 additions and 46 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Mon Mar 16 08:42:47 GMT 2026 #Mon Mar 16 18:30:19 GMT 2026
stageCount=0 stageCount=0
libraryProject= libraryProject=
baseVersion=15.11 baseVersion=15.11
publishVersion=15.0.0 publishVersion=15.0.0
buildCount=53 buildCount=54
baseBetaVersion=15.0.1 baseBetaVersion=15.0.1

View File

@@ -4,9 +4,6 @@
package="cc.winboll.studio.autonfc"> package="cc.winboll.studio.autonfc">
<uses-permission android:name="android.permission.NFC"/> <uses-permission android:name="android.permission.NFC"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-feature <uses-feature
android:name="android.hardware.nfc" android:name="android.hardware.nfc"

View File

@@ -1,9 +1,5 @@
package cc.winboll.studio.autonfc.nfc; package cc.winboll.studio.autonfc.nfc;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service; import android.app.Service;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@@ -13,12 +9,9 @@ import android.nfc.NfcAdapter;
import android.nfc.Tag; import android.nfc.Tag;
import android.nfc.tech.Ndef; import android.nfc.tech.Ndef;
import android.os.Binder; import android.os.Binder;
import android.os.Build;
import android.os.IBinder; import android.os.IBinder;
import android.widget.Toast;
import cc.winboll.studio.autonfc.MainActivity; import cc.winboll.studio.autonfc.MainActivity;
import cc.winboll.studio.autonfc.R;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.ToastUtils; import cc.winboll.studio.libappbase.ToastUtils;
@@ -28,8 +21,6 @@ import java.util.Arrays;
public class AutoNFCService extends Service { public class AutoNFCService extends Service {
public static final String TAG = "AutoNFCService"; public static final String TAG = "AutoNFCService";
private static final int NOTIFICATION_ID = 1001;
private static final String CHANNEL_ID = "NFC_SERVICE_CHANNEL";
// ================= 已修改:更新为 Beta 包名 ================= // ================= 已修改:更新为 Beta 包名 =================
public static final String ACTION_BUILD = "cc.winboll.studio.winboll.termux.NfcTermuxBridgeActivity.ACTION_BUILD"; public static final String ACTION_BUILD = "cc.winboll.studio.winboll.termux.NfcTermuxBridgeActivity.ACTION_BUILD";
@@ -44,7 +35,7 @@ public class AutoNFCService extends Service {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
LogUtils.d(TAG, "onCreate() -> 服务创建"); LogUtils.d(TAG, "onCreate() -> 服务创建");
startForeground(NOTIFICATION_ID, buildNotification()); // 移除:startForeground(NOTIFICATION_ID, buildNotification());
} }
@Override @Override
@@ -64,7 +55,7 @@ public class AutoNFCService extends Service {
@Override @Override
public boolean onUnbind(Intent intent) { public boolean onUnbind(Intent intent) {
LogUtils.d(TAG, "onUnbind() -> 服务解绑"); LogUtils.d(TAG, "onUnbind() -> 服务解绑");
stopForeground(true); // 移除:stopForeground(true);
stopSelf(); stopSelf();
return super.onUnbind(intent); return super.onUnbind(intent);
} }
@@ -170,13 +161,6 @@ public class AutoNFCService extends Service {
} }
try { try {
// String json = String.format(
// "{\"script\":\"%s\",\"args\":[\"%s\"],\"workDir\":null,\"background\":%b,\"resultDir\":null}",
// "BuildWinBoLLProject.sh",
// nfcData,
// action.equals(ACTION_BUILD)
// );
LogUtils.d(TAG, "executeTermuxCommand() -> 发送指令: " + nfcData); LogUtils.d(TAG, "executeTermuxCommand() -> 发送指令: " + nfcData);
Intent bridgeIntent = new Intent(action); Intent bridgeIntent = new Intent(action);
@@ -208,27 +192,6 @@ public class AutoNFCService extends Service {
return sb.toString(); return sb.toString();
} }
private Notification buildNotification() {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, "NFC 后台服务", NotificationManager.IMPORTANCE_LOW);
channel.setSound(null, null);
channel.setVibrationPattern(null);
nm.createNotificationChannel(channel);
}
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
return new Notification.Builder(this)
.setChannelId(CHANNEL_ID)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("NFC 服务运行中")
.setContentText("等待卡片扫描")
.setContentIntent(pi)
.build();
}
// ========================= Binder ========================= // ========================= Binder =========================
public class LocalBinder extends Binder { public class LocalBinder extends Binder {
public AutoNFCService getService() { public AutoNFCService getService() {