illogical-robot / apkmirror-public

APKMirror.com bugs
http://www.apkmirror.com
111 stars 32 forks source link

APKMirror Installer: .apkm fails to install on devices running MIUI #116

Open panhoong opened 4 years ago

panhoong commented 4 years ago

Actual behavior

When I try to install the Netflix .apkm file using the APKMirror Installer, it gives me an error message: "App installation failed. The system failed to install the package because of system issues."

On Xiaomi Mi 8 running on Android 10 (MIUI 11.0.6 China Stable release, QEACNXM)

the4anoni commented 4 years ago

Try disabling miui optimizations, install app, and re-enable miui optimizations.

Xiaomi.eu team fixed this issue in their weekly roms, but for SAI, not APKmirror installer.

archon810 commented 4 years ago

@panhoong Can you please confirm whether this works?

@the4anoni Do you have the relevant thread url where the fix was mentioned? I'm curious what the problem may be.

It's probably not going to get fixed on older devices. I wonder if we can detect whether MIUI optimizations are on programmatically and pop something up to disable them.

the4anoni commented 4 years ago

@panhoong Can you please confirm whether this works?

@the4anoni Do you have the relevant thread url where the fix was mentioned? I'm curious what the problem may be.

It's probably not going to get fixed on older devices. I wonder if we can detect whether MIUI optimizations are on programmatically and pop something up to disable them.

https://github.com/Aefyr/SAI/commit/0f9fe36ae9a6173d92ef05c402ff1dd568b649a0

Kacskrz is from xiaomi.eu team

archon810 commented 4 years ago

Thank you.

Xiaomi.eu team fixed this issue in their weekly roms, but for SAI, not APKmirror installer.

I don't know anything about the fix itself, but I doubt it's specific to SAI. SAI just shows a warning to MIUI users, and I'm afraid we have no choice but to do the same.

However, the good news is we managed to get in touch with a Xiaomi engineer and have given him the details of the issue, so maybe something will happen as a result.

archon810 commented 4 years ago

I've left a note for MIUI users in the app description, and we're probably going to show a warning in the event of an installation failure. Our developer ordered a Poco device, so we'll be able to test the fix soon.

asesinopr commented 4 years ago

Hi! Im having issues trying to checkmark Architecture part. Is there anything I can do? Im using an androidbox t95.

archon810 commented 4 years ago

@asesinopr Please open a separate issue and explain it in more detail. It doesn't seem related to this MIUI issue.

IgorEisberg commented 4 years ago

Try disabling miui optimizations, install app, and re-enable miui optimizations.

Xiaomi.eu team fixed this issue in their weekly roms, but for SAI, not APKmirror installer.

I'm Igor from Xiaomi.eu team. APKMirror Installer works fine here. Tested by installing Netflix APKM bundle. No issues at all. The reason being that we disable the restriction that only allows select few package names to initiate installer sessions on our ROMs. (it can also be disabled by disabling MIUI optimization, which we remove from our ROMs as it's not relevant since we disable nonsense like that ourselves by default). You can always check if MIUI optimizations are on by checking the "persist.sys.miui_optimization" system property (values are either 1 or 0). You can also use reflection on the "isXOptMode" method (no arguments, returns a primitive boolean) in class "android.miui.AppOpsUtils", but the result's meaning is reversed (true means that the user has opted out of MIUI optimization). However, it is very unlikely that APKMirror team can do anything about that restriction, it's part of MIUI's framework security policy.

archon810 commented 4 years ago

@IgorEisberg Are you confirming that your ROMs have added com.apkmirror.helper.prod to the whitelist?

IgorEisberg commented 4 years ago

@IgorEisberg Are you confirming that your ROMs have added com.apkmirror.helper.prod to the whitelist?

No, I confirmed that we have no blacklist/whitelist, I completely disabled the restriction, any installer should work fine, like on AOSP ROMs.

archon810 commented 4 years ago

Thank you. Now if only Xiaomi would remove this ridiculous limitation from their core ROMs, but so far our attempts to convince their engineer have failed.

IgorEisberg commented 4 years ago

As far as I understand, from security stand-point, the purpose is to prevent malicious installers from silently pushing malicious apps... but there's already a security measure for that: the "Install unknown apps" special permission which has to be explicitly granted by the user. So... I really don't see the actual purpose of this restriction.

AndroidDeveloperLB commented 4 years ago

It can't be done silently if it already asks the user to confirm the installation anyway via the OS dialog, so this behavior is useless and not needed.

Are you guys saying that starting from some Android/MIUI version this behavior is gone? If so, from which?

the4anoni commented 4 years ago

It can't be done silently if it already asks the user to confirm the installation anyway via the OS dialog, so this behavior is useless and not needed.

Are you guys saying that starting from some Android/MIUI version this behavior is gone? If so, from which?

Only from Xiaomi.eu 20.2.20 and never. Stock Miui still has this problem.

AndroidDeveloperLB commented 4 years ago

@the4anoni Stock? Xiaomi has various types of MIUI ? One for Europe and one for something else (China?) ?

Why the need for it? Why can't they use the standard that developers can handle? Once an app tries to install another app, the OS already asks the user if it's ok to install.

Xiaomi is one of the most terrible ones on the https://dontkillmyapp.com/ website, with made up rules that are turned on by default, breaking apps. Users usually don't even notice because of white-lists of popular apps, and when they do, they blame the developers because it works fine on the popular apps. And developers have nothing to do about it...

Xiaomi should stop with these made up rules, at least by default. Let only users who enable them (manually, when they reach the settings) deal with the breaking of apps. It's unfair that Xiaomi lets some apps work fine and some not, by default.

the4anoni commented 4 years ago

@the4anoni Stock? Xiaomi has various types of MIUI ? One for Europe and one for something else (China?) ?

Why the need for it? Why can't they use the standard that developers can handle? Once an app tries to install another app, the OS already asks the user if it's ok to install.

Xiaomi is one of the most terrible ones on the https://dontkillmyapp.com/ website, with made up rules that are turned on by default, breaking apps. Users usually don't even notice because of white-lists of popular apps, and when they do, they blame the developers because it works fine on the popular apps. And developers have nothing to do about it...

Xiaomi should stop with these made up rules, at least by default. Let only users who enable them (manually, when they reach the settings) deal with the breaking of apps. It's unfair that Xiaomi lets some apps work fine and some not, by default.

Xiaomi has many stock ROMs:

  1. China: Stable Weekly
  2. Global Stable
  3. EEA Stable
  4. Russia Stable
  5. India Stable

Xiaomi.eu is Custom rom based on China, both Stable or weekly.

AndroidDeveloperLB commented 4 years ago

@the4anoni Why is it called "Xiaomi.eu" ? I thought it means "Europe" .

Which of those stock ROMs has the problematic behavior and which don't? How in code do you check that it has it?

This was mentioned above:

You can always check if MIUI optimizations are on by checking the "persist.sys.miui_optimization" system property (values are either 1 or 0). You can also use reflection on the "isXOptMode" method (no arguments, returns a primitive boolean) in class "android.miui.AppOpsUtils", but the result's meaning is reversed (true means that the user has opted out of MIUI optimization).

Is it official? Can it be used without worrying ? How can I find more of such special flags (example the "auto-start" permission of Xiaomi) ? And is there an Intent that developers can use to reach the exact setting for users to reach and enable/disable them there?

the4anoni commented 4 years ago

@the4anoni Why is it called "Xiaomi.eu" ? I thought it means "Europe" .

Because this project started long time before Xiaomi made Miui for other regions than China.

All stock ROMs don't work with SAI or apkmirror installer.

AndroidDeveloperLB commented 4 years ago

@the4anoni Didn't you guys say that the restriction was removed from MIUI at some point and it should work fine ? Maybe it's from some MIUI version, or something?

Quotes:

"APKMirror Installer works fine here. Tested by installing Netflix APKM bundle. No issues at all" "I completely disabled the restriction, any installer should work fine, like on AOSP ROMs."

On SAI, it claims it should not be needed from MIUI 20.2.20 , and I've found only one forum thread that only has a clue about this, but nothing official: https://xiaomi.eu/community/threads/need-to-turn-off-miui-optimization-for-mi-9.54624/

Is it possible that on some stock ROMs of Xiaomi, starting from this version, the restriction is disabled by default (or doesn't even exist) ?

the4anoni commented 4 years ago

@the4anoni Didn't you guys say that the restriction was removed from MIUI at some point and it should work fine ? Maybe it's from some MIUI version, or something?

Quotes:

"APKMirror Installer works fine here. Tested by installing Netflix APKM bundle. No issues at all" "I completely disabled the restriction, any installer should work fine, like on AOSP ROMs."

On SAI, it claims it should not be needed from MIUI 20.2.20 , and I've found only one forum thread that only has a clue about this, but nothing official: https://xiaomi.eu/community/threads/need-to-turn-off-miui-optimization-for-mi-9.54624/

Is it possible that on some stock ROMs of Xiaomi, starting from this version, the restriction is disabled by default (or doesn't even exist) ?

Xiaomi.eu is still a Miui

AndroidDeveloperLB commented 4 years ago

@the4anoni You didn't answer the question...

the4anoni commented 4 years ago

@the4anoni You didn't answer the question...

I did, read all discussion again. Nobody said this was fixed in stock Xiaomi ROMs.

AndroidDeveloperLB commented 4 years ago

@the4anoni I gave you quotes about it, showing that the dev of Xiaomi said it worked fine for him, and that he disabled the restriction.

Also, SAI says as such (search for "installer_miui_warning_message") :

https://github.com/Aefyr/SAI/blob/bd4d4eb37016711b6250caa276359f4bdad3d2fb/app/src/main/res/values/strings.xml

This issue is supposed to be fixed on MIUI 20.2.20 and up (xiaomi.eu and eu-based ROMs).

AndroidDeveloperLB commented 4 years ago

Anyway, attached here a sample POC to check on Xiaomi's restriction. Hope this could help anyone here.

My Application.zip

the4anoni commented 4 years ago

@the4anoni I gave you quotes about it, showing that the dev of Xiaomi said it worked fine for him, and that he disabled the restriction.

Also, SAI says as such (search for "installer_miui_warning_message") :

https://github.com/Aefyr/SAI/blob/bd4d4eb37016711b6250caa276359f4bdad3d2fb/app/src/main/res/values/strings.xml

This issue is supposed to be fixed on MIUI 20.2.20 and up (xiaomi.eu and eu-based ROMs).

This is xiaomi.eu dev, not Xiaomi Stock Rom developer...

AndroidDeveloperLB commented 4 years ago

Sorry was probably confused.

archon810 commented 4 years ago

I was also pretty confused at first as Xiaomi.eu sounds pretty official but looks like it's a custom ROM fork that isn't official at all.

AndroidDeveloperLB commented 4 years ago

@archon810 That being said, what he wrote about checking is correct at least on a device I've tested (via the POC I've attached), which is Xiaomi Redmi 8.

I don't know if it works on other Xiaomi devices, and if it will change in the future. My guess is that it's ok to use it.

IgorEisberg commented 4 years ago

@the4anoni Why is it called "Xiaomi.eu" ? I thought it means "Europe" .

Even I don't know the answer for that. Confusing, sure. Many think that it's an official ROM just because of this name choice. However, Xiaomi.eu has existed way before I joined in. EU does mean Europe, and it's out main focus. Most, but not all, supported languages on our ROMs are European.

Which of those stock ROMs has the problematic behavior and which don't? How in code do you check that it has it?

All of them, except for our custom ROM or any other kangers that used our ROMs as a base for theirs.

Is it official? Can it be used without worrying ?

Yes, it's the official way to check if MIUI optimization is active/inactive. Been like this for ages.

I don't know if it works on other Xiaomi devices, and if it will change in the future. My guess is that it's ok to use it.

Not likely to change. It's been like this for ages. Sadly, there's no real way to tell if the restriction is actually taking place on a certain MIUI ROM, so you can't differentiate between an official Global ROM and a Xiaomi.eu custom ROM, unless you check for certain build props we added (for example, checking if value if System.getProperty("ro.product.mod_device") contains "xiaomieu". Other than that, all official ("stock") ROMs suffer from this restriction when MIUI optimizations are enabled. Just a little note: disabling MIUI optimizations affects heavily on system's behavior, permission handling and some settings that are supposed to be hidden will be exposed, so disabling it should only be temporary. If you want to learn more about the restriction, you should decompile a services.jar from an official ROM, and check for a class called "PackageManagerServiceInjector", the method is called "isAllowedInstall". You'll see an "isXOptMode" call in there.

How can I find more of such special flags (example the "auto-start" permission of Xiaomi) ?

Eh... not sure... there are many MIUI-exclusive flags around, none of them can tell you if the restriction applies, the most sure one is "persist.sys.miui_optimization", although warning about this prop not being disabled on a Xiaomi.eu ROM would be meaningless, as there is no switch on our ROMs.

And is there an Intent that developers can use to reach the exact setting for users to reach and enable/disable them there?

Sadly the only way to toggle it off is either manually from Developer options, or setting the persist.sys.miui_optimization prop to 0 (which third-party apps probably can't do without root access). As such, third-party apps can't interfere with its state.

AndroidDeveloperLB commented 4 years ago

@IgorEisberg Does it even matter which kind of ROM it is ? Shouldn't it mean that once the function I made returns true, we can expect issues in terms of installation ?

I don't understand the last remark. Do you show me instructions on how to find other values like this one? If so, can you please point to a link showing all of those of MIUI ? I wonder if there is something related to the dreadful "auto-start" permission and other app-related permissions that Xiaomi made up ("home screen shortcuts", "show on lock screen", "display popup windows while running in the background",...)

IgorEisberg commented 4 years ago

@IgorEisberg Does it even matter which kind of ROM it is ? Shouldn't it mean that once the function I made returns true, we can expect issues in terms of installation ?

Yes, but you can make an exception if System.getProperty("ro.product.mod_device", "") contains "xiaomieu", just so users don't go looking for a switch that doesn't exist when they don't have to be warned in the first place.

I don't understand the last remark. Do you show me instructions on how to find other values like this one? If so, can you please point to a link showing all of those of MIUI ? I wonder if there is something related to the dreadful "auto-start" permission and other app-related permissions that Xiaomi made up ("home screen shortcuts", "show on lock screen", "display popup windows while running in the background",...)

I'm not aware of any documentation about that. MIUI is not open-source. AFAIK, Auto-start permission is granted by default nowadays on MIUI. As for the other permissions, not sure why you need that, but it's all part of MIUI Permission Manager which is only partially used on official Global ROMs (but fully used on China ROMs and our ROMs as well, although heavily patched to behave properly with modern runtime permissions).

AndroidDeveloperLB commented 4 years ago

@IgorEisberg I don't understand your first remark. Can't I assume what I wrote? You mean that it could also give me false-positive? That in some cases it could tell me that it's turned on, but it's not, that that it says it's turned on, but in fact it doesn't cause any installation issues?

MIUI is not open-source.

How come it says on wikipedia that MIUI is open sourced? https://en.wikipedia.org/wiki/MIUI

Auto-start permission is granted by default nowadays on MIUI.

Maybe on latest versions of it, which I can't try because I don't see an update to it. I tested now on Redmi 8 which has "MIUI Global 11.0.5", Android 9 PKQ1.190319.001 , and that's incorrect. Maybe the most popular apps get it enabled by default. The rest have it disabled by default, hence breaking them.

As for the other permissions, not sure why you need that, but it's all part of MIUI Permission Manager which is only partially used on official Global ROMs (but fully used on China ROMs and our ROMs as well, although heavily patched to behave properly with modern runtime permissions).

That's incorrect. I can see all that I've mentioned on the device I wrote about. As for "why you need that", that's because as long as MIUI breaks apps by default, without any kind of API and without any known standard of Android, it ruins experience for users, and users will always blame developers and not Xiaomi, unless they are power users who dig deep into the cause of these issues. Xiaomi is quite a popular manufacturer, yet it's one of the worst ones by breaking apps. You should see how many developers are frustrated by their decisions: https://dontkillmyapp.com/ https://issuetracker.google.com/issues/122098785 Developers had to go write whole support pages just to explain users about the various issues of devices, because of all the non-standard behaviors, which break apps by default.

the4anoni commented 4 years ago

MIUI is not open-source How come it says on wikipedia that MIUI is open sourced? https://en.wikipedia.org/wiki/MIUI

From the same link: Open source (Android Base and Main Framework) with Proprietary components (Miui Apps and Kits)

AFAIK only parts that need to be open source are open source (kernel and vendor). Other things are proprietary.

AndroidDeveloperLB commented 4 years ago

@the4anoni So the extra (terrible) permissions they made - are not open sourced?

IgorEisberg commented 4 years ago

@the4anoni So the extra (terrible) permissions they made - are not open sourced?

Nope.

You mean that it could also give me false-positive? That in some cases it could tell me that it's turned on, but it's not...

No, if the prop is set to 1, it means MIUI optimizations are on. No false positives in that regard.

...that it says it's turned on, but in fact it doesn't cause any installation issues?

True only in the case of Xiaomi.eu custom ROMs. We have MIUI optimization enabled as well, but the installer restriction part was patched out.

MIUI is not open-source.

How come it says on wikipedia that MIUI is open sourced? https://en.wikipedia.org/wiki/MIUI

It's inaccurate. Kernels are open-source, nothing more.

...it ruins experience for users, and users will always blame developers and not Xiaomi, unless they are power users who dig deep into the cause of these issues.

That shouldn't be your concern... If users want a predictable experience, they shouldn't use any of the third-party customized Android variants. You shouldn't feel responsible for that, best you can do is warn the user as a courtesy...

AndroidDeveloperLB commented 4 years ago

@IgorEisberg So the check that I've used is correct, right?

True only in the case of Xiaomi.eu custom ROMs. We have MIUI optimization enabled as well, but the installer restriction part was patched out.

So you mean non-stock. For non-stock, everything can happen, even more than Xiaomi's stock.

It's inaccurate. Kernels are open-source, nothing more.

If it's not open sourced, how did you make a custom ROM? Only change the kernel? But changing the kernel, it's mostly about under the hood stuff...

That shouldn't be your concern... If users want a predictable experience, they shouldn't use any of the third-party customized Android variants. You shouldn't feel responsible for that, best you can do is warn the user as a courtesy...

That's the thing: They are using stock ROMs of Xiaomi's devices, and it ruins the experience by default. Those are not custom ROMs. Just check the link I've provided and see how many are frustrated by their decisions that ruin the OS.

IgorEisberg commented 4 years ago

@IgorEisberg So the check that I've used is correct, right?

Not sure what check you used, but the safest one would be, IMO:

if (SystemProperties.getBoolean("persist.sys.miui_optimization", false) && !SystemProperties.get("ro.product.mod_device", "").contains("xiaomieu") {
    # There will probably be an installation problem, show a MIUI optimization warning
}

So you mean non-stock. For non-stock, everything can happen, even more than Xiaomi's stock.

I can't speak for other custom ROMs. Maybe they patched it, maybe the have no idea how to. So yeah, anything can happen.

If it's not open sourced, how did you make a custom ROM? Only change the kernel? But changing the kernel, it's mostly about under the hood stuff...

Apktool, and we have our own modified version of it that works nicely with MIUI. For the APKs/JARs we use our own pattern-based patcher I had to build from scratch, since the normal patch utility that comes with Linux is not suitable for this, as many MIUI apps change with every ROM update, and many of them are minified (makes normal patching basically impossible without making a separate patch for every single update and Android version). The boot image is patched as well so that a custom ROM can even be booted, which requires alleviating some of the kernel's anti-temper protection. And so, having the source code is not always necessary to build a custom ROM.

That's the thing: They are using stock ROMs of Xiaomi's devices, and it ruins the experience by default. Those are not custom ROMs. Just check the link I've provided and see how many are frustrated by their decisions that ruin the OS.

Sure, but they should complain to the company they paid to, not spit their frustration on third-party app developers. It ruins the experience, but it's not your fault, nor there's anything you can do. Third-party apps have absolutely no authority to disable that, unless root is used of course.

AndroidDeveloperLB commented 4 years ago

The check is in the POC I've attached. Here's the snippet:

    /**@return true iff we've detected that MIUI OS has MIUI optimization enabled. Returns null when failed to detect anything about it*/
    fun isMiuiOptimizationEnabled(): Boolean? {
        try {
            var miuiOptimizationEnabled = getSystemProperty("persist.sys.miui_optimization")
            if (miuiOptimizationEnabled == null)
                miuiOptimizationEnabled = getSystemPropertyUsingProcess("persist.sys.miui_optimization")
            if (miuiOptimizationEnabled != null)
                return miuiOptimizationEnabled == "true"
            val clazz = Class.forName("android.miui.AppOpsUtils")
            val isOptedOutOfMiuiOptimization = clazz.getMethod("isXOptMode").invoke(null) as Boolean
            return !isOptedOutOfMiuiOptimization
        } catch (e: Exception) {
            return null
        }
    }

About the ROM making, that's heavy modding and tons of work compared to working with open sourced ROMs, no? You probably many times try things that don't work as you wanted.

Sure, but they should complain to the company they paid to, not spit their frustration on third-party app developers. It ruins the experience, but it's not your fault, nor there's anything you can do. Third-party apps have absolutely no authority to disable that, unless root is used of course.

That's what I'm saying. There is nothing developers can do about it. Users will keep blaming apps instead of blaming Xiaomi.

IgorEisberg commented 4 years ago

The check is in the POC I've attached. Here's the snippet:

    /**@return true iff we've detected that MIUI OS has MIUI optimization enabled. Returns null when failed to detect anything about it*/
    fun isMiuiOptimizationEnabled(): Boolean? {
        try {
            var miuiOptimizationEnabled = getSystemProperty("persist.sys.miui_optimization")
            if (miuiOptimizationEnabled == null)
                miuiOptimizationEnabled = getSystemPropertyUsingProcess("persist.sys.miui_optimization")
            if (miuiOptimizationEnabled != null)
                return miuiOptimizationEnabled == "true"
            val clazz = Class.forName("android.miui.AppOpsUtils")
            val isOptedOutOfMiuiOptimization = clazz.getMethod("isXOptMode").invoke(null) as Boolean
            return !isOptedOutOfMiuiOptimization
        } catch (e: Exception) {
            return null
        }
    }

Looks fine (I never had to use Kotlin yet, but it's not that different in essence), probably too much checks for the same thing, not sure why that would be necessary. Adding an exception for Xiaomi.eu like I showed above would save some confusion though.

About the ROM making, that's heavy modding and tons of work compared to working with open sourced ROMs, no? You probably many times try things that don't work as you wanted.

Obviously. It's working with Dalvik/ART op codes, not Java/Kotlin, and there's no IDE for that and barely any compile-time checks, so typos are easy to do. But I've been doing it for a while already, I'm used to it.

AndroidDeveloperLB commented 4 years ago

@IgorEisberg It's just fallbacks. As for Xiaomi.eu check, I think it's better to avoid it, because others might add their own mod, and the handling of those won't end... It's too much already to need to do something about Xiaomi. They should have not broken Android, at least not by default.

IgorEisberg commented 4 years ago

@IgorEisberg It's just fallbacks. As for Xiaomi.eu check, I think it's better to avoid it, because others might add their own mod, and the handling of those won't end... It's too much already to need to do something about Xiaomi. They should have not broken Android, at least not by default.

Just don't prevent the user from using the app unless he turns off MIUI optimization, because it's not possible on our ROMs without root.

AndroidDeveloperLB commented 4 years ago

Why should it require root, if it's available without root on stock? Also, seeing how much it breaks apps, shouldn't you disable it completely, by default?

the4anoni commented 4 years ago

Why should it require root, if it's available without root on stock? Also, seeing how much it breaks apps, shouldn't you disable it completely, by default?

  1. Because xiaomi.eu removed switch for that in their roms.
  2. Disabling Miui Optimization may cause unexpected consequences.
AndroidDeveloperLB commented 4 years ago

@the4anoni

  1. Can't it be modded like the rest that you do?
  2. You can't live with it, and can't live without it... What could it cause? It's an official toggle of Xiaomi's devices. Granted, it's in the developer options for some reason, but it's reverting some things to how they are supposed to work.
IgorEisberg commented 4 years ago

@the4anoni

  1. Can't it be modded like the rest that you do?
  2. You can't live with it, and can't live without it... What could it cause? It's an official toggle of Xiaomi's devices. Granted, it's in the developer options for some reason, but it's reverting some things to how they are supposed to work.

Like I said, we patched the issue limiting third-party installers, so disabling MIUI optimizations is not required here. Other than that, MIUI optimizations cause no known issues, but disabling it does cause quite a few of them. It's an official toggle, yet not intended for the average user.

AndroidDeveloperLB commented 4 years ago

@IgorEisberg What issues does it cause, to disable it?

IgorEisberg commented 4 years ago

@IgorEisberg What issues does it cause, to disable it?

Permission configs will slightly change, certain settings that are not supposed to be displayed will be displayed and some of them will cause a crash or unexpected behavior if the user tries to use them, and there's a lot of under-the-hood behaviors that will change. I don't know all of them, but there are many checks across the system.

AndroidDeveloperLB commented 4 years ago

@IgorEisberg The OS will crash on some cases just because you disabled it? What is the scenario exactly, to cause a crash just because you've done it? Does it include even user behavior that doesn't use anything of the special things of MIUI (meaning only vanilla features) ?

IgorEisberg commented 4 years ago

@IgorEisberg The OS will crash on some cases just because you disabled it? What is the scenario exactly, to cause a crash just because you've done it? Does it include even user behavior that doesn't use anything of the special things of MIUI (meaning only vanilla features) ?

Look, I'm not exactly into testing what happens when MIUI optimizations are off, this isn't one of our usage scenarios. One example to what happens when disabling it (might have been changed already, don't know) is that Always-on display setting is being displayed on devices with LCD screens. Those devices don't have the MiuiAod.apk that is responsible for AOD, so clicking that setting will cause Settings app to crash because the activity can't be found.

AndroidDeveloperLB commented 4 years ago

@IgorEisberg I now tested on Xiaomi Redmi 8, and disabling MIUI optimizations didn't cause a crash when enabling/disabling always-on-display. However, I don't think it does anything, with or without MIUI optimizations turned on. I don't get why it even exists... I tried to restart the OS even (when both of these are turned on), but this feature doesn't do anything, and it got even weirder: the feature of always-on-display was gone.

Seems that disabling MIUI optimizations lets you see always-on-display setting, even though it doesn't do anything at all.