提交 1de559c6 编写于 作者: B Blankj

see 04/18 log

上级 9bafcbf7
......@@ -41,7 +41,7 @@
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.13-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.14-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.13-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.14-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -57,7 +57,7 @@ dependencies {
// LeakCanary
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
// implementation 'com.blankj:utilcode:1.13.13'
// implementation 'com.blankj:utilcode:1.13.14'
}
......@@ -33,8 +33,8 @@ ext {
min_sdk_version = 14
target_sdk_version = 27
version_code = 1_013_013
version_name = '1.13.13'// E.g 1.9.72 => 1,009,072
version_code = 1_013_014
version_name = '1.13.14'// E.g 1.9.72 => 1,009,072
// App dependencies
support_version = '27.1.0'
......
* 18/04/19 新增 Process#isMainProcess 和 Process#getCurrentProcessName,发布 1.13.14 版本
* 18/04/18 修复 LogUtils 头部空指针异常,SPUtils、CacheUtils 存储空值异常,发布 1.13.13 版本
* 18/04/17 修复 ToastUtils 内存泄漏问题,感谢 [LambertCoding](https://github.com/LambertCoding),发布 1.13.12 版本
* 18/04/16 完善 AppUtils#installAppSilent 路径包含空格问题,发布 1.13.11 版本
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.13.13'
implementation 'com.blankj:utilcode:1.13.14'
```
......@@ -430,6 +430,8 @@ sendSmsSilent : 发送短信
getForegroundProcessName : 获取前台线程包名
killAllBackgroundProcesses: 杀死所有的后台服务进程
killBackgroundProcesses : 杀死后台服务进程
isMainProcess : 判断是否运行在主进程
getCurrentProcessName : 获取当前进程名称
```
* ### 反射相关 -> [ReflectUtils.java][reflect.java] -> [Test][reflect.test]
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.13.13'
implementation 'com.blankj:utilcode:1.13.14'
```
......@@ -430,6 +430,8 @@ sendSmsSilent
getForegroundProcessName
killAllBackgroundProcesses
killBackgroundProcesses
isMainProcess
getCurrentProcessName
```
* ### About Reflect -> [ReflectUtils.java][reflect.java] -> [Test][reflect.test]
......
......@@ -130,7 +130,7 @@ public final class AppUtils {
* {@code <uses-permission android:name="android.permission.INSTALL_PACKAGES" />}</p>
*
* @param filePath The path of file.
* @param params The params of installation.
* @param params The params of installation(e.g.,<code>-r</code>, <code>-s</code>).
* @return {@code true}: success<br>{@code false}: fail
*/
public static boolean installAppSilent(final String filePath, final String params) {
......@@ -143,7 +143,7 @@ public final class AppUtils {
* {@code <uses-permission android:name="android.permission.INSTALL_PACKAGES" />}</p>
*
* @param file The file.
* @param params The params of installation.
* @param params The params of installation(e.g.,<code>-r</code>, <code>-s</code>).
* @return {@code true}: success<br>{@code false}: fail
*/
public static boolean installAppSilent(final File file, final String params) {
......
......@@ -22,6 +22,8 @@ import android.widget.LinearLayout;
import java.lang.reflect.Method;
import static android.Manifest.permission.EXPAND_STATUS_BAR;
/**
* <pre>
* author: Blankj
......@@ -515,7 +517,7 @@ public final class BarUtils {
*
* @param isVisible True to set notification bar visible, false otherwise.
*/
@RequiresPermission(android.Manifest.permission.EXPAND_STATUS_BAR)
@RequiresPermission(EXPAND_STATUS_BAR)
public static void setNotificationBarVisibility(final boolean isVisible) {
String methodName;
if (isVisible) {
......
......@@ -9,6 +9,7 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Process;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresPermission;
......@@ -193,4 +194,34 @@ public final class ProcessUtils {
}
return true;
}
/**
* Return whether app running in the main process.
*
* @return {@code true}: yes<br>{@code false}: no
*/
public static boolean isMainProcess() {
return Utils.getApp().getPackageName().equals(getCurrentProcessName());
}
/**
* Return the name of current process.
*
* @return the name of current process
*/
public static String getCurrentProcessName() {
ActivityManager am = (ActivityManager) Utils.getApp().getSystemService(Context.ACTIVITY_SERVICE);
if (am == null) return null;
List<ActivityManager.RunningAppProcessInfo> info = am.getRunningAppProcesses();
if (info == null || info.size() == 0) return null;
int pid = Process.myPid();
for (ActivityManager.RunningAppProcessInfo aInfo : info) {
if (aInfo.pid == pid) {
if (aInfo.processName != null) {
return aInfo.processName;
}
}
}
return null;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册