2025-06-27 V1.1.0
- *.[新增]支持开启和暂停监控。 - *.[改进]忽略米家app手表连接的消息。 - *.[改进]忽略滴滴出行的天气提醒。
This commit is contained in:
parent
36d068baf1
commit
99ae79d96e
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
<bytecodeTargetLevel target="21" />
|
||||
</component>
|
||||
</project>
|
10
.idea/deploymentTargetSelector.xml
Normal file
10
.idea/deploymentTargetSelector.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetSelector">
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
</project>
|
|
@ -4,16 +4,16 @@
|
|||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
|
|
@ -21,5 +21,10 @@
|
|||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
<option name="url" value="https://jcenter.bintray.com/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
10
.idea/migrations.xml
Normal file
10
.idea/migrations.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="..\:/My Datas/My Codes/android code/TellMeNotice/app/src/main/res/layout/activity_main.xml" value="0.33" />
|
||||
<entry key="..\:/My Datas/My Codes/android code/TellMeNotice/app/src/main/res/layout/float_tip.xml" value="0.18489583333333334" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
17
.idea/runConfigurations.xml
Normal file
17
.idea/runConfigurations.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -1,12 +1,27 @@
|
|||
#### 2025-06-27 V1.1.0
|
||||
|
||||
- *.[新增]支持开启和暂停监控。
|
||||
- *.[改进]忽略米家app手表连接的消息。
|
||||
- *.[改进]忽略滴滴出行的天气提醒。
|
||||
|
||||
#### 2022-11-17 V1.0.4
|
||||
|
||||
- *.[改进]优化米家提醒,短时间内的批量提醒不再重复提示音。
|
||||
- *.[改进]楼下按门铃提醒的弹窗标题和内容进行对调。
|
||||
- *.[改进]过滤哈啰顺风车某些不重要提醒。
|
||||
|
||||
#### 2020-12-21 V1.0.2
|
||||
|
||||
- *.[新增]新增微信红包提醒
|
||||
- *.[改进]更全面的识别淘口令。
|
||||
- *.[改进]更全面的识别快递签收提醒。
|
||||
|
||||
#### 2020-12-18 V1.0.1
|
||||
|
||||
- *.[新增]支持通过wifi名称来判断是否在上班。
|
||||
- *.[新增]增加游戏模式(尚未完成)。
|
||||
- *.[改进]不连公司wifi的情况下,个性化购物和淘口令声音。
|
||||
|
||||
#### 2020-11-28 V1.0
|
||||
|
||||
- 暂无。
|
|
@ -3,15 +3,15 @@ plugins {
|
|||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "30.0.2"
|
||||
compileSdkVersion 31
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.itrycn.tellmenotice"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
versionCode 3
|
||||
versionName "1.0.2"
|
||||
minSdkVersion 28
|
||||
//noinspection EditedTargetSdkVersion
|
||||
targetSdkVersion 28
|
||||
versionCode 9
|
||||
versionName "1.1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
@ -26,16 +26,16 @@ android {
|
|||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
namespace 'com.itrycn.tellmenotice'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'com.jakewharton:butterknife:8.8.1'
|
||||
implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
|
||||
def qmui_arch_version = '2.0.0-alpha10'
|
||||
implementation 'com.qmuiteam:qmui:2.0.1'
|
||||
def qmui_arch_version = '2.0.1'
|
||||
implementation "com.qmuiteam:arch:$qmui_arch_version"
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.itrycn.tellmenotice">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
|
@ -14,6 +15,13 @@
|
|||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
<!--如果是安卓10.0,需要后台获取连接的wifi名称则添加进程获取位置信息权限 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
<!-- 允许应用程序发现和配对蓝牙设备 -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADACCESS_FINE_LOCATIONMIN" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<!-- 允许应用程序连接到已配对的蓝牙设备并进行数据传输 -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<!-- 允许应用发起对蓝牙设备的连接 -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
@ -23,7 +31,8 @@
|
|||
android:supportsRtl="true"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:theme="@style/Theme.TellMeNotice">
|
||||
<activity android:name=".MainActivity" android:process=":BackgroundService">
|
||||
<activity android:name=".MainActivity" android:process=":BackgroundService"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
@ -35,7 +44,8 @@
|
|||
android:excludeFromRecents="true"
|
||||
android:launchMode="singleTask"
|
||||
android:process=":BackgroundService"
|
||||
android:taskAffinity="com.open.helper" />
|
||||
android:taskAffinity="com.open.helper"
|
||||
android:exported="true"/>
|
||||
<receiver android:name=".BootBroadcastReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
|
@ -55,7 +65,8 @@
|
|||
android:name=".NoticeService"
|
||||
android:priority="1000"
|
||||
android:label="通知监控"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.service.notification.NotificationListenerService" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.itrycn.tellmenotice;
|
|||
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PixelFormat;
|
||||
|
@ -35,7 +37,7 @@ public class FloatView implements View.OnTouchListener {
|
|||
|
||||
mWm = (WindowManager) context.getApplicationContext().getSystemService(
|
||||
Context.WINDOW_SERVICE);
|
||||
|
||||
|
||||
mWinParams = new WindowManager.LayoutParams();
|
||||
//mWinParams.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
//mWinParams.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
|
@ -99,6 +101,15 @@ public class FloatView implements View.OnTouchListener {
|
|||
TextView idPostTime = view.findViewById(R.id.IdPostTime);
|
||||
idTitle.setText(Title);
|
||||
idContent.setText(Content);
|
||||
idContent.setOnClickListener(v -> {
|
||||
try {
|
||||
ClipboardManager clipboard = (ClipboardManager)mContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText(null,Content));
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(mContext, "复制出错->"+e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");// HH:mm:ss
|
||||
//获取当前时间
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
|
|
|
@ -3,18 +3,24 @@ package com.itrycn.tellmenotice;
|
|||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -23,7 +29,6 @@ import com.itrycn.ta.OpenAccessibilitySettingHelper;
|
|||
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
|
||||
import com.qmuiteam.qmui.widget.QMUITopBar;
|
||||
import com.qmuiteam.qmui.widget.QMUITopBarLayout;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
@ -36,9 +41,12 @@ public class MainActivity extends AppCompatActivity {
|
|||
*
|
||||
*/
|
||||
public static Context mContext;
|
||||
private SharedPreferences sharedPreferences;
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
// 沉浸式状态栏
|
||||
//QMUIStatusBarHelper.translucent(this);
|
||||
//初始化状态栏
|
||||
|
@ -67,6 +75,27 @@ public class MainActivity extends AppCompatActivity {
|
|||
"1.帮你监控系统通知,自动筛选重要通知。\n" +
|
||||
"2.不同通知展现不同的提醒界面和声音。\n" +
|
||||
"3.支持免打扰功能,深夜自动免打扰。");
|
||||
Button btn=findViewById(R.id.BtnStartMon);
|
||||
btn.setText("开启游戏模式");
|
||||
btn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean GameMode=sharedPreferences.getBoolean("GameMode", false);
|
||||
if(sharedPreferences.getBoolean("GameMode", false))
|
||||
{
|
||||
sharedPreferences.edit().putBoolean("GameMode", false).apply();
|
||||
btn.setText("开启游戏模式");
|
||||
}
|
||||
else{
|
||||
sharedPreferences.edit().putBoolean("GameMode", true).apply();
|
||||
btn.setText("关闭游戏模式");
|
||||
}
|
||||
Intent intent = new Intent("com.itrycn.notice.ACTION_SEND_MESSAGE");
|
||||
intent.putExtra("mode", "notice");
|
||||
intent.putExtra("GameMode", !GameMode);
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
});
|
||||
ScreenListener screenlistener = new ScreenListener(this);
|
||||
screenlistener.begin(new ScreenListener.ScreenStateListener() {
|
||||
|
||||
|
@ -89,16 +118,35 @@ public class MainActivity extends AppCompatActivity {
|
|||
AudioManager audioManager = (AudioManager) MainActivity.this.getSystemService(Context.AUDIO_SERVICE);
|
||||
int NoticeVolume= audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
int NoticeMaxVolume= audioManager.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
if(NoticeVolume<100)
|
||||
{
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 100, AudioManager.FLAG_VIBRATE);
|
||||
int NoticeMinVolume= audioManager.getStreamMinVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
if(getWifiName().indexOf("当游")>=0) { //当连接到公司wifi
|
||||
if(hour==12 || hour==13)
|
||||
{
|
||||
//audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, NoticeMinVolume, AudioManager.FLAG_PLAY_SOUND);
|
||||
}
|
||||
else {
|
||||
//audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, NoticeMinVolume+(NoticeMaxVolume-NoticeMinVolume)/2, AudioManager.FLAG_PLAY_SOUND);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (NoticeVolume < 100) {
|
||||
//audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, NoticeMinVolume+(NoticeMaxVolume-NoticeMinVolume)*3/4, AudioManager.FLAG_PLAY_SOUND);
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
//Log.e("onScreenOff", "onScreenOff");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取wifi名称(必须要有GPS定位权限)
|
||||
*/
|
||||
private String getWifiName()
|
||||
{
|
||||
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
|
||||
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
||||
return wifiInfo.getSSID();
|
||||
}
|
||||
private void initTopBar() {
|
||||
mTopBar.setBackgroundColor(ContextCompat.getColor(this, R.color.app_color_theme_4));
|
||||
mTopBar.addRightImageButton(R.drawable.menu,R.id.menu).setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -122,7 +170,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
protected void onStart() {
|
||||
if(!AccessibilityOperator.getInstance().isServiceRunning())
|
||||
{
|
||||
Toast.makeText(this,"辅助服务没有在运行。", Toast.LENGTH_SHORT).show();
|
||||
//Toast.makeText(this,"辅助服务没有在运行。", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
super.onStart();
|
||||
}
|
||||
|
|
|
@ -1,14 +1,23 @@
|
|||
package com.itrycn.tellmenotice;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Application;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.drawable.Icon;
|
||||
|
@ -23,6 +32,9 @@ import android.net.wifi.WifiManager;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.Messenger;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.service.notification.NotificationListenerService;
|
||||
import android.service.notification.StatusBarNotification;
|
||||
|
@ -40,7 +52,10 @@ import android.widget.RemoteViews;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
@ -48,16 +63,31 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class NoticeService extends NotificationListenerService {
|
||||
public static boolean isStarted = false;
|
||||
public static String CurPackageName = "";
|
||||
private WindowManager windowManager;
|
||||
private WindowManager.LayoutParams layoutParams;
|
||||
private boolean gameMode=false;
|
||||
private final BroadcastReceiver messageReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if ("com.itrycn.notice.ACTION_SEND_MESSAGE".equals(intent.getAction())) {
|
||||
gameMode = intent.getBooleanExtra("GameMode",false);
|
||||
// 处理收到的消息
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
isStarted = true;
|
||||
IntentFilter filter = new IntentFilter("com.itrycn.notice.ACTION_SEND_MESSAGE");
|
||||
registerReceiver(messageReceiver, filter);
|
||||
//配置声音类型。
|
||||
AudioAttributes.Builder builder = new AudioAttributes.Builder();
|
||||
builder.setLegacyStreamType(AudioManager.STREAM_NOTIFICATION);
|
||||
|
@ -69,29 +99,41 @@ public class NoticeService extends NotificationListenerService {
|
|||
.setAudioAttributes(builder.build());
|
||||
|
||||
sp = builder2.build();
|
||||
MP3_notice = sp.load(this,R.raw.notice,1);
|
||||
MP3_mm= sp.load(this,R.raw.chattip,1);
|
||||
MP3_Ring= sp.load(this,R.raw.ring,1);
|
||||
MP3_kuaidi= sp.load(this,R.raw.kuaidi,1);
|
||||
MP3_Dingding= sp.load(this,R.raw.dingding,1);
|
||||
MP3_TaoCode= sp.load(this,R.raw.taocode,1);
|
||||
MP3_Buy0= sp.load(this,R.raw.buy0,1);
|
||||
MP3_RedPacket= sp.load(this,R.raw.redpacket,1);
|
||||
MP3_notice = sp.load(this, R.raw.notice, 1);
|
||||
MP3_mm = sp.load(this, R.raw.chattip, 1);
|
||||
MP3_Ring = sp.load(this, R.raw.ring, 1);
|
||||
MP3_kuaidi = sp.load(this, R.raw.kuaidi, 1);
|
||||
MP3_Dingding = sp.load(this, R.raw.dingding, 1);
|
||||
MP3_TaoCode = sp.load(this, R.raw.taocode, 1);
|
||||
MP3_Buy0 = sp.load(this, R.raw.buy0, 1);
|
||||
MP3_RedPacket = sp.load(this, R.raw.redpacket, 1);
|
||||
sp.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
|
||||
@Override
|
||||
public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
|
||||
// 音频加载完成后的处理
|
||||
AudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
|
||||
//int NoticeVolume= audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
//int NoticeMaxVolume= audioManager.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
//int NoticeMinVolume= audioManager.getStreamMinVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, NoticeVolume, AudioManager.FLAG_PLAY_SOUND);
|
||||
}
|
||||
});
|
||||
//windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
|
||||
//layoutParams = new WindowManager.LayoutParams();
|
||||
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
// } else {
|
||||
// layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;
|
||||
// } else {
|
||||
// layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;
|
||||
//}
|
||||
//layoutParams.format = PixelFormat.TRANSLUCENT;
|
||||
//layoutParams.gravity = Gravity.LEFT | Gravity.TOP;
|
||||
//layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
// layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
// layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
// layoutParams.x = 300;
|
||||
// layoutParams.y = 300;
|
||||
// layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
// layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
// layoutParams.x = 300;
|
||||
// layoutParams.y = 300;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
sp.unload(MP3_notice);
|
||||
|
@ -102,15 +144,18 @@ public class NoticeService extends NotificationListenerService {
|
|||
sp.unload(MP3_TaoCode);
|
||||
sp.unload(MP3_Buy0);
|
||||
sp.unload(MP3_RedPacket);
|
||||
unregisterReceiver(messageReceiver);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.i("KEVIN", "Service is started" + "-----");
|
||||
//
|
||||
//
|
||||
//data = intent.getStringExtra("data");
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
SoundPool sp;
|
||||
int MP3_notice;
|
||||
int MP3_mm;
|
||||
|
@ -120,10 +165,63 @@ public class NoticeService extends NotificationListenerService {
|
|||
int MP3_TaoCode;
|
||||
int MP3_Buy0;
|
||||
int MP3_RedPacket;
|
||||
String Last_packageName="";
|
||||
String Last_Title="";
|
||||
String Last_Content="";
|
||||
long Last_UpdateTime=0;
|
||||
String Last_packageName = "";
|
||||
String Last_Title = "";
|
||||
String Last_Content = "";
|
||||
long Last_UpdateTime = 0;
|
||||
|
||||
/**
|
||||
* 判断给定的设备名称是否已连接经典蓝牙
|
||||
*
|
||||
* @param BlueToothName 蓝牙设备名称
|
||||
* @return
|
||||
*/
|
||||
public boolean isConnectClassicBT(String BlueToothName) {
|
||||
if (TextUtils.isEmpty(BlueToothName)) {
|
||||
return false;
|
||||
}
|
||||
final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
Class<BluetoothAdapter> bluetoothAdapterClass = BluetoothAdapter.class;//得到BluetoothAdapter的Class对象
|
||||
try {
|
||||
//是否存在连接的蓝牙设备
|
||||
Method method = bluetoothAdapterClass.getDeclaredMethod("getConnectionState", (Class[]) null);
|
||||
//打开权限
|
||||
method.setAccessible(true);
|
||||
int state = (int) method.invoke(bluetoothAdapter, (Object[]) null);
|
||||
if (state == BluetoothAdapter.STATE_CONNECTED) {
|
||||
Log.d("test", "BluetoothAdapter.STATE_CONNECTED");
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
||||
// TODO: Consider calling
|
||||
// ActivityCompat#requestPermissions
|
||||
// here to request the missing permissions, and then overriding
|
||||
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||
// int[] grantResults)
|
||||
// to handle the case where the user grants the permission. See the documentation
|
||||
// for ActivityCompat#requestPermissions for more details.
|
||||
return false;
|
||||
}
|
||||
Set<BluetoothDevice> devices = bluetoothAdapter.getBondedDevices();
|
||||
Log.d("test", "devices:" + devices.size());
|
||||
for (BluetoothDevice device : devices) {
|
||||
Method isConnectedMethod = BluetoothDevice.class.getDeclaredMethod("isConnected", (Class[]) null);
|
||||
method.setAccessible(true);
|
||||
boolean isConnected = (boolean) isConnectedMethod.invoke(device, (Object[]) null);
|
||||
if (isConnected) {
|
||||
{
|
||||
return BlueToothName.contains(device.getName());
|
||||
}
|
||||
} else {
|
||||
Log.d("test", device.getName() + " connect false(" + device.getAddress() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 播放声音
|
||||
* @param SoundId 声音id
|
||||
|
@ -132,6 +230,7 @@ public class NoticeService extends NotificationListenerService {
|
|||
*/
|
||||
private void PlaySound(int SoundId,int loop,boolean DNDPlay)
|
||||
{
|
||||
float volume=1f;
|
||||
if(!DNDPlay) //如果该声音未开启免打扰时允许播放,则检查当前是否属于免打扰
|
||||
{
|
||||
Calendar c = Calendar.getInstance();
|
||||
|
@ -140,17 +239,40 @@ public class NoticeService extends NotificationListenerService {
|
|||
//int day = c.get(Calendar.DAY_OF_MONTH); // 获取当日
|
||||
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK); // 获取当前日期的星期,1 表示星期日、用 2 表示星期一
|
||||
int hour = c.get(Calendar.HOUR_OF_DAY); // 时
|
||||
//int minute = c.get(Calendar.MINUTE); // 分
|
||||
int minute = c.get(Calendar.MINUTE); // 分
|
||||
if(hour>=23 || hour<7) {return; } //23点到早上7点,免打扰时间段
|
||||
AudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
|
||||
NoticeVolume= audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
int NoticeMaxVolume= audioManager.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
int NoticeMinVolume= audioManager.getStreamMinVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
if(getWifiName().indexOf("当游")>=0) { //当连接到公司wifi
|
||||
if(hour==12 || (hour==13 && minute<=30))
|
||||
{
|
||||
return;//是中午,则不播放声音
|
||||
}
|
||||
else {
|
||||
volume=0.3f;//不是中午,音量降低
|
||||
}
|
||||
if(NoticeVolume==NoticeMinVolume) {
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, NoticeMinVolume + Math.round((NoticeMaxVolume - NoticeMinVolume) * 1/(float)2), AudioManager.FLAG_PLAY_SOUND);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(NoticeVolume<(NoticeMinVolume+(NoticeMaxVolume-NoticeMinVolume)/2)) {
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, NoticeMinVolume + Math.round((NoticeMaxVolume - NoticeMinVolume) * 3/(float)4), AudioManager.FLAG_PLAY_SOUND);
|
||||
}
|
||||
}
|
||||
//if(hour>=23 && hour<7) {return; }
|
||||
}
|
||||
AudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
|
||||
int NoticeVolume= audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
int NoticeMaxVolume= audioManager.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 100, AudioManager.FLAG_VIBRATE);
|
||||
sp.play(SoundId, 1f, 1.0f,1,loop,1);
|
||||
if(isConnectClassicBT("CARKIT"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
sp.play(SoundId, volume, volume,1,loop,1);
|
||||
//audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, NoticeVolume, AudioManager.FLAG_PLAY_SOUND);
|
||||
//audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, NoticeVolume, AudioManager.FLAG_VIBRATE);
|
||||
}
|
||||
private int NoticeVolume=0;
|
||||
//在进程中去寻找当前APP的信息,判断是否在前台运行
|
||||
private boolean isAppOnForeground(String packageName) {
|
||||
return NoticeService.CurPackageName.equals(packageName);
|
||||
|
@ -161,7 +283,9 @@ public class NoticeService extends NotificationListenerService {
|
|||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return gameMode;
|
||||
// 读取数据
|
||||
//return sharedPreferences.getBoolean("GameMode", false);
|
||||
}
|
||||
/**
|
||||
* 获取wifi名称(必须要有GPS定位权限)
|
||||
|
@ -173,6 +297,7 @@ public class NoticeService extends NotificationListenerService {
|
|||
return wifiInfo.getSSID();
|
||||
}
|
||||
private long LastDoorRingTime=0;
|
||||
private long MiHomeTipTime=0;
|
||||
@Override
|
||||
public void onNotificationPosted(StatusBarNotification sbn) {
|
||||
// super.onNotificationPosted(sbn);
|
||||
|
@ -293,22 +418,30 @@ public class NoticeService extends NotificationListenerService {
|
|||
{
|
||||
//region 米家app处理方式
|
||||
if(Title.equals("GroupSummary") ||Content.equals("GroupSummary")){return;};
|
||||
if(Title.contains("按门铃") || Content.contains("按门铃"))
|
||||
if(Title.contains("你有一条新消息") ||Content.contains("你有一条新消息")){return;};
|
||||
if(Title.contains("与手表米家连接中") ||Content.contains("与手表米家连接中")){return;};
|
||||
if(Title.contains("设备状态") || Content.contains("设备状态")){return;};
|
||||
if(Title.contains("楼下有人按门铃") || Content.contains("楼下有人按门铃"))
|
||||
{
|
||||
if(LastDoorRingTime+60000>=NowTime){return;} //如果1分钟内有新的门铃提醒,则自动忽略
|
||||
LastDoorRingTime=c.getTime().getTime();
|
||||
if(!IsGameMode()) {
|
||||
FloatView fv = new FloatView(this);
|
||||
fv.showFloatingWindow(notice, Content, Title, Color.parseColor("#02BD9D"));
|
||||
fv.showFloatingWindow(notice,Title, Content, Color.parseColor("#02BD9D"));
|
||||
}
|
||||
if(MiHomeTipTime+5000<NowTime) {
|
||||
MiHomeTipTime = c.getTime().getTime();
|
||||
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
|
||||
vibrator.vibrate(new long[]{100,10,100,1000}, -1);
|
||||
PlaySound(MP3_Ring, 1, false);
|
||||
}
|
||||
PlaySound(MP3_Ring,1,false);
|
||||
haveTip=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!IsGameMode()) {
|
||||
FloatView fv = new FloatView(this);
|
||||
if (Title.equals("自动化通知")) {
|
||||
if (Title.equals("自动化通知") || Title.equals("智能通知")) {
|
||||
fv.showFloatingWindow(notice, Title, Content, Color.parseColor("#02BD9D"));
|
||||
} else {
|
||||
if (Title.length() >= Content.length()) {
|
||||
|
@ -319,7 +452,12 @@ public class NoticeService extends NotificationListenerService {
|
|||
}
|
||||
}
|
||||
haveTip=true;
|
||||
PlaySound(MP3_Dingding,0,false);
|
||||
if(MiHomeTipTime+5000<NowTime) {
|
||||
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
|
||||
vibrator.vibrate(new long[]{100,10,100,1000}, -1);
|
||||
MiHomeTipTime = c.getTime().getTime();
|
||||
PlaySound(MP3_Dingding, 0, false);
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
}
|
||||
|
@ -341,13 +479,39 @@ public class NoticeService extends NotificationListenerService {
|
|||
}
|
||||
//endregion
|
||||
}
|
||||
else if(packageName.equals("com.jingyao.easybike") //哈罗出行
|
||||
else if(packageName.equals("com.jingyao.easybike") //哈啰出行
|
||||
|| packageName.equals("com.sdu.didi.psnger") //滴滴出行
|
||||
|| packageName.equals("com.didapinche.booking")) //嘀嗒出行
|
||||
{
|
||||
if(Title.contains("正在运行")){return;}
|
||||
if(Title.contains("哈啰顺风车运行中") || Content.contains("哈啰顺风车运行中")){return;}
|
||||
if(Title.contains("顺风车出行中") || Content.contains("顺风车出行中")){return;}
|
||||
if(Content.contains("正在运行")){return;}
|
||||
if(Title.contains("哈啰顺风车运行中") || Content.contains("哈啰顺风车运行中")|| Content.contains("哈啰出行使用中")){return;}
|
||||
if(Content.contains("附近有一笔订单")){return;}
|
||||
if(Title.contains("顺风车出行中") || Content.contains("顺风车出行中") || Content.contains("行程安全保障") || Content.contains("行程录音中")){return;}
|
||||
if(Content.contains("您有一条消息")){return;}
|
||||
if(Content.contains("有一条新消息")){return;}
|
||||
if(Content.contains("您有新的消息")){return;}
|
||||
if(Content.contains("使用中")){return;}
|
||||
if(Content.contains("已隐藏敏感")){return;}
|
||||
if(Title.contains("天气提醒")){return;}
|
||||
if(packageName.equals("com.jingyao.easybike"))//哈啰出行
|
||||
{
|
||||
if(!Title.contains("顺路"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(packageName.equals("com.didapinche.booking"))//嘀嗒出行
|
||||
{
|
||||
if(!Content.contains("顺路"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!Title.contains("新订单"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(!IsGameMode()) {
|
||||
//region 如果是顺风车线路
|
||||
FloatView fv = new FloatView(this);
|
||||
|
@ -385,6 +549,16 @@ public class NoticeService extends NotificationListenerService {
|
|||
}
|
||||
//endregion
|
||||
}
|
||||
else if(packageName.equals("com.dreame.smartlife")) //追觅
|
||||
{
|
||||
if(!IsGameMode()) {
|
||||
FloatView fv = new FloatView(this);
|
||||
fv.showFloatingWindow(notice, Title, Content, Color.parseColor("#020202"));
|
||||
}
|
||||
PlaySound(MP3_Dingding,0,false);
|
||||
haveTip=true;
|
||||
//endregion
|
||||
}
|
||||
//else {
|
||||
// Toast.makeText(this,packageName+"->"+Title+"-"+Content, Toast.LENGTH_SHORT).show();
|
||||
// sp.play(MP3_notice, 1f, 1.0f, 1, 0, 1);
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.itrycn.tellmenotice;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class SettingService extends Service {
|
||||
private final Messenger messenger = new Messenger(new IncomingHandler());
|
||||
|
||||
private static class IncomingHandler extends Handler {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
// 处理收到的消息
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return messenger.getBinder();
|
||||
}
|
||||
}
|
|
@ -12,12 +12,39 @@
|
|||
android:layout_height="88dp"
|
||||
android:background="@color/app_color_theme_4"
|
||||
android:fitsSystemWindows="true" />
|
||||
<TextView
|
||||
android:id="@+id/IdState"
|
||||
android:layout_width="287dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="95dp"
|
||||
android:text="@string/app_state" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
<TextView
|
||||
android:id="@+id/IdState"
|
||||
android:layout_width="287dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="95dp"
|
||||
android:text="@string/app_state" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/BtnStartMon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="关闭监控"/>
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.0-alpha15'
|
||||
classpath 'com.android.tools.build:gradle:8.7.2'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
@ -15,6 +15,9 @@ buildscript {
|
|||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
//maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
maven { url 'https://maven.aliyun.com/repository/central' }
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,4 +16,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
|||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
android.enableJetifier=true
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.nonTransitiveRClass=false
|
||||
android.nonFinalResIds=false
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
7
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,7 @@
|
|||
#Sat Oct 03 18:50:49 CST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
312
gradlew
vendored
312
gradlew
vendored
|
@ -1,78 +1,130 @@
|
|||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
@ -81,92 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
|
78
gradlew.bat
vendored
78
gradlew.bat
vendored
|
@ -1,4 +1,22 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
|
@ -9,25 +27,29 @@
|
|||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
@ -35,48 +57,36 @@ goto fail
|
|||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
|
1405
hs_err_pid52728.log
Normal file
1405
hs_err_pid52728.log
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user