shortx命令
1 subscriber
1 photo
1 file
5 links
Download Telegram
Channel created
Forwarded from 星霜笔记
//判断热点状态
import android.content.Context;
import android.net.wifi.WifiManager;
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
return wifiManager.isWifiApEnabled();

//判断GPS状态
import android.location.LocationManager;
locationManager = context.getSystemService(context.LOCATION_SERVICE);
boolean gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);

//判断NFC状态
import android.nfc.NfcAdapter;
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter();
boolean isEnabled = nfcAdapter != null && nfcAdapter.isEnabled();
return isEnabled;

//数据状态
import android.content.Context;
import android.telephony.TelephonyManager;
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
boolean isDataEnabled = telephonyManager.getDataEnabled();

//蓝牙
import android.bluetooth.BluetoothAdapter;
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
boolean isBluetoothEnabled = bluetoothAdapter.isEnabled();

//WiFi状态
import android.content.Context;
import android.net.wifi.WifiManager;
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
boolean isWifiEnabled = wifiManager.isWifiEnabled();

//是否处于通话中
import android.content.Context;
import android.telephony.TelephonyManager;
telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
int callState = telephonyManager.getCallState();
return callState == TelephonyManager.CALL_STATE_OFFHOOK || callState == TelephonyManager.CALL_STATE_RINGING;

//获取飞行模式状态
import android.provider.Settings;
int airplaneMode = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0);
return airplaneMode == 1;

#mvel
Forwarded from 星霜笔记
//微信快捷启动(bizshortcut方式1)
am start "intent:#Intent;action=com.tencent.mm.action.BIZSHORTCUT;B.LauncherUI.From.Biz.Shortcut=true;S.LauncherUI.Shortcut.Username=wxid;end";

//微信聊天页面启动(带等待/重启,公众号)
am start -W -S -n com.tencent.mm/.ui.chatting.ChattingUI --es Chat_User gh_;

//微信聊天页面启动(指定模式,个人号)
am start -n com.tencent.mm/com.tencent.mm.ui.chatting.ChattingUI --ei Chat_Mode 1 --es Chat_User wxid;

//微信快捷启动(bizshortcut方式2,指定组件+启动旗标)
am start "intent:#Intent;action=com.tencent.mm.action.BIZSHORTCUT;launchFlags=0x10000000;component=com.tencent.mm.plugin.base.stub.WXEntryActivity;B.LauncherUI.From.Biz.Shortcut=true;S.LauncherUI.Shortcut.Username=wxid;end";

//微信聊天页面启动(带flags参数)
am start -n com.tencent.mm/.ui.chatting.ChattingUI --es Chat_User wxid -f 0x14000000;

#微信聊天页面启动 #shell
Forwarded from 星霜笔记
// 原低优先级类型(仅悬浮窗,受权限/层级限制)
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY

// 最高优先级类型:突破悬浮窗限制,可覆盖锁屏、状态栏、通知栏
WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;

// 解除布局边界限制:允许视图延伸到状态栏/导航栏区域显示
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
Forwarded from 星霜笔记
import java.net.HttpURLConnection;
import java.net.URL;

// 创建一个URL对象,指向百度网站
URL url = new URL("https://baidu.com");

// 打开一个HTTP连接
HttpURLConnection connection = (HttpURLConnection) url.openConnection();

// 设置HTTP请求方法为GET
connection.setRequestMethod("GET");

// 设置连接超时时间为1秒
connection.setReadTimeout(1000); // 1秒

// 获取HTTP响应码
int responseCode = connection.getResponseCode();

// 如果收到的状态码不是在400-499范围内,则输出网络连接正常
if (responseCode < 400 || responseCode >= 500) {
    ("网络连接正常");
}

#mvel
Forwarded from 星霜笔记
function isDeviceMoving(threshold, durationMs) {
    var Thread = java.lang.Thread;
    var context = android.app.ActivityThread.currentApplication().getApplicationContext();
    var sensorManager = context.getSystemService(android.content.Context.SENSOR_SERVICE);
    var gyroSensor = sensorManager.getDefaultSensor(android.hardware.Sensor.TYPE_GYROSCOPE);
    var motionDetected = false;
    var listener = new android.hardware.SensorEventListener({
        onSensorChanged: function(event) {
            var x = event.values[0];
            var y = event.values[1];
            var z = event.values[2];
            var magnitude = Math.sqrt(x*x + y*y + z*z);

            if(magnitude > threshold) {
                motionDetected = true;
            }
        },
        onAccuracyChanged: function(sensor, accuracy) {}
    });
    sensorManager.registerListener(listener, gyroSensor, android.hardware.SensorManager.SENSOR_DELAY_NORMAL);
    Thread.sleep(durationMs);
    sensorManager.unregisterListener(listener);
    return motionDetected;
}

// 示例调用:阈值 0.1 rad/s,检测 5 秒
isDeviceMoving(0.1, 5000);

判断设备是否处于运动状态
Forwarded from 星霜笔记
//获取已连接蓝牙设备电量

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import java.util.Set;

// 获取默认的蓝牙适配器
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

// 创建 StringBuilder 存储结果
StringBuilder resultBuilder = new StringBuilder();

// 如果蓝牙适配器不为空且已启用
if (bluetoothAdapter != null && bluetoothAdapter.isEnabled()) {
// 获取已绑定的设备集合
Set connectedDevices = bluetoothAdapter.getBondedDevices();

// 检查是否找到连接的设备
if (!connectedDevices.isEmpty()) {
// 遍历已绑定的设备
for (BluetoothDevice device : connectedDevices) {
// 如果设备已连接
if (device.isConnected()) {
// 获取该设备的地址
String connectedDeviceAddress = device.getAddress();

// 通过设备地址获取远程设备
BluetoothDevice connectedDevice = bluetoothAdapter.getRemoteDevice(connectedDeviceAddress);

// 获取设备的电池电量
int batteryLevel = connectedDevice.getBatteryLevel();

// 构建设备信息字符串
String deviceInfo = "设备名称: " + connectedDevice.getName() + "\n" +
"设备地址: " + connectedDevice.getAddress() + "\n";

// 检查是否成功获取到电池电量
if (batteryLevel != -1) {
// 添加电池电量信息
deviceInfo += "电池电量: " + batteryLevel + "%\n";
} else {
// 添加电池电量获取失败信息
deviceInfo += "电池电量获取失败\n";
}

// 添加设备信息到结果
resultBuilder.append(deviceInfo).append("\n");
}
}
} else {
// 没有连接的设备
resultBuilder.append("没有连接蓝牙设备。\n");
}
} else {
// 蓝牙适配器为空或未启用
resultBuilder.append("蓝牙未启用或适配器不可用。\n");
}

// 输出结果
return resultBuilder.toString();
Forwarded from 星霜笔记
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import java.io.File;
import android.os.Environment;

Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);

// 指定要刷新的文件路径(必须/storage/emulated/0/开头)
//intent.setData(Uri.fromFile(new File("/storage/emulated/0/Download/")));

//刷新内部存储
intent.setData(Uri.fromFile(Environment.getExternalStorageDirectory()));

context.sendBroadcast(intent);

也可以使用广播刷新
Forwarded from 𝓗𝓮
importClass(android.os.ServiceManager);
importClass(android.os.Parcel);
importClass(java.lang.Class);

function getPassword() {

var binder = ServiceManager.getService("lock_settings");
if (binder == null) {
console.log("无法获取 lock_settings 服务");
return null;
}

var stubClass = Class.forName("com.android.internal.widget.ILockSettings$Stub");
var field = stubClass.getDeclaredField("TRANSACTION_getPassword");
field.setAccessible(true);
var TRANSACTION_getPassword = field.getInt(null);

var data = Parcel.obtain();
var reply = Parcel.obtain();

try {

data.writeInterfaceToken("com.android.internal.widget.ILockSettings");

binder.transact(TRANSACTION_getPassword, data, reply, 0);

reply.readException();
var password = reply.readString();

return password;
} finally {
data.recycle();
reply.recycle();
}
}

// 测试
var pwd = getPassword();
if (pwd == "default_password") {

"未设置密码或需要锁屏验一次证";
} else {

pwd;
}
Forwarded from 𝓗𝓮
import android.telephony.SubscriptionManager;

subscriptionManager = context.getSystemService("telephony_subscription_service");
activeSubscriptions = subscriptionManager.getActiveSubscriptionInfoList();

phoneNumbers = [];
if (activeSubscriptions != null) {
for (subscriptionInfo : activeSubscriptions) {
phoneNumber = subscriptionInfo.getNumber();
if (phoneNumber != null && !phoneNumber.isEmpty()) {
phoneNumbers.add(phoneNumber);
}
}
}

return phoneNumbers.isEmpty() ? "未找到手机号码" : phoneNumbers;
Forwarded from 𝓗𝓮
Plumin
想获取当前使用流量的卡槽,怎么弄?
import android.telephony.SubscriptionManager;

subscriptionManager = context.getSystemService("telephony_subscription_service");
defaultDataSubId = SubscriptionManager.getDefaultDataSubscriptionId();

// 获取卡槽 0 和卡槽 1 的订阅信息
simSlot1Info = subscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(0);
simSlot2Info = subscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(1);

if (simSlot1Info != null && simSlot1Info.getSubscriptionId() == defaultDataSubId) {
return true;
} else if (simSlot2Info != null && simSlot2Info.getSubscriptionId() == defaultDataSubId) {
return false;
} else {
return "未找到默认上网卡";
}
//卡一输出true,卡二输出false
Forwarded from 𝓗𝓮
import java.io.File;

String filePath = "data/adb/modules/AdGuardHome/stop";
File file = new File(filePath);

// 返回文件是否存在
return !file.exists();
//不存在输出true