mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-29 09:58:54 +03:00
Attempt to fix Xiaomi
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
2b2ec99e2d
commit
c59a003d2a
1 changed files with 5 additions and 16 deletions
|
@ -22,13 +22,11 @@ package com.nextcloud.talk.utils;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ApplicationInfo;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -48,20 +46,11 @@ public class DeviceUtils {
|
||||||
if (result instanceof Integer) {
|
if (result instanceof Integer) {
|
||||||
Integer integerResult = (Integer) result;
|
Integer integerResult = (Integer) result;
|
||||||
if (integerResult == 0) {
|
if (integerResult == 0) {
|
||||||
Class<ApplicationInfo> clazz = ApplicationInfo.class;
|
Method setApplicationAutoStartMethod = aClass.getDeclaredMethod("setApplicationAutoStart",
|
||||||
Field[] fields = clazz.getDeclaredFields();
|
Context.class, String.class, Boolean.TYPE);
|
||||||
|
if (setApplicationAutoStartMethod != null) {
|
||||||
for (Field field : fields) {
|
setApplicationAutoStartMethod.invoke(aClass, applicationContext, applicationContext.getPackageName(),
|
||||||
field.setAccessible(true);
|
Boolean.TRUE);
|
||||||
if (field.getName().equals("FLAG_DISABLE_AUTOSTART")) {
|
|
||||||
int value = field.getInt(ApplicationInfo.class);
|
|
||||||
if (value != 0) {
|
|
||||||
field.setInt(ApplicationInfo.class, 0);
|
|
||||||
field.setAccessible(false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
field.setAccessible(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue