LibreShift / red-moon

Android screen filter app for night time phone use.
GNU General Public License v3.0
642 stars 80 forks source link

Upgrade to SDK 28 #257

Closed AdamNiederer closed 4 years ago

AdamNiederer commented 4 years ago

Tested on a real device running 8.1.0, and AVDs running 8.0, 6.0, 5.1, 4.3, 4.1, and 4.0.

Resolves #242; Resolves #259

smichel17 commented 4 years ago

I'd like to try to keep 4.x support if possible, since those devices don't have a built in filter like most 7+ devices do. Red Moon was working on 4.x when last I heard, and there haven't been many changes since then -- I'm curious what's causing the error now. At the least, I'm pretty sure Settings.System.canWrite is only checked on versions that have it.

I've also been hesitant to upgrade the target sdk because I'm worried that will bring some of the undesirable-but-unavoidable behavior (eg, can't filter lockscreen and statusbar) to older devices. I could be wrong about this, I just haven't really looked into it because I know it will be a bunch of work to migrate and my phone is still running 7.x, so I haven't needed to for myself :P. IIRC this is also the reason why I hadn't updated some of the dependencies, the more recent version threw a fit and I didn't want to deal with it. Google Play requires targeting a more recent version, but the Red Moon listing there is broken anyway due to an issue on @raatmarien's end, so I only really care about f-droid right now.

In the end, maybe that means splitting Red Moon into two versions, one for older devices that's only on fdroid and one for new devices on both stores?

It's late and I don't feel like looking at code now. I'm somewhat busy in my personal life at the moment so I'm not sure when I will come look at this, but I at least wanted to give some context.

AdamNiederer commented 4 years ago

I'd like to try to keep 4.x support if possible, since those devices don't have a built in filter like most 7+ devices do. Red Moon was working on 4.x when last I heard, and there haven't been many changes since then -- I'm curious what's causing the error now. At the least, I'm pretty sure Settings.System.canWrite is only checked on versions that have it.

It has something to do with inflating a TextView, but I can't figure out where or why it's happening. I've only tested ICS, so it might work on Jellybean or Kitkat. For canWrite, My testing on Lollipop was limited to stuff after my changes, so I may have removed a check further up in the program. We're definitely not checking API levels anywhere near the callsite, though.

Making it work on at least Lollipop is definitely doable - I'll add that to the patch. ICS might be questionable, but I'll see if my google-fu can turn up anything.

I've also been hesitant to upgrade the target sdk because I'm worried that will bring some of the undesirable-but-unavoidable behavior (eg, can't filter lockscreen and statusbar) to older devices. I could be wrong about this, I just haven't really looked into it because I know it will be a bunch of work to migrate and my phone is still running 7.x, so I haven't needed to for myself :P. IIRC this is also the reason why I hadn't updated some of the dependencies, the more recent version threw a fit and I didn't want to deal with it. Google Play requires targeting a more recent version, but the Red Moon listing there is broken anyway due to an issue on @raatmarien's end, so I only really care about f-droid right now.

On APIs below 26 (Oreo), this patch will elect to use the deprecated TYPE_SYSTEM_OVERLAY rather than the newer (inferior) TYPE_APPLICATION_OVERLAY. I don't have a suitable real device to test this on, unfortunately, but it still darkens the notification bar, shade, and lockscreen on my MM AVD.

It's late and I don't feel like looking at code now. I'm somewhat busy in my personal life at the moment so I'm not sure when I will come look at this, but I at least wanted to give some context.

No problem! I'm in no hurry :)

AdamNiederer commented 4 years ago

I figured out the crash, and I've gotten it working on API level 14 again - was using a material design color which wasn't in appcompat.

guillaume-d commented 4 years ago

I'd like to try to keep 4.x support if possible, since those devices don't have a built in filter like most 7+ devices do. Red Moon was working on 4.x when last I heard, and there haven't been many changes since then -- I'm curious what's causing the error now. At the least, I'm pretty sure Settings.System.canWrite is only checked on versions that have it.

See #259.

AdamNiederer commented 4 years ago

Closing in favor of #260, which includes extra patches to get us up to spec with SDK 29.