Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No automated function at all #137

Closed
LukasThyWalls opened this issue Apr 7, 2017 · 24 comments
Closed

No automated function at all #137

LukasThyWalls opened this issue Apr 7, 2017 · 24 comments
Labels

Comments

@LukasThyWalls
Copy link

LukasThyWalls commented Apr 7, 2017

App Version: 2.10.2 from F-droid.
Android Version: Android 6.0 in Huawei P8 Lite with EMUI 4.0.

I don't know if i'm doing something wrong.

I can switch on/off the red filter with the general button in the app, but i can't make it work automaticly with the time function. It's activated and i put manual and automatic time (it picks the right time for my time zone) but the red filter only works with the general button, and the time function doesn't matter, the red filter has never activates or deactivates with the times configured.

My phone has default function to don't keep alive apps, but Red Moon is configured as protected app and this shouldn't be a problem.

And, well, i know is not the same, but Twilight App works with automatic switch on/off, but i think the red filter in Red Moon fits better in my phone. Only for pointing that.

Thanks in advance.

@smichel17 smichel17 added the bug label Apr 7, 2017
@smichel17
Copy link
Member

smichel17 commented Apr 7, 2017

Hi, thanks for the bug report!

Just to confirm, it doesn't work using "Times from sun" or custom times, correct?

My phone has default function to don't keep alive apps, but Red Moon is configured as protected app and this shouldn't be a problem.

I'm not 100% sure, but Red Moon should work without this.
Better to keep it protected while we're trying to work this out, though :)

@smichel17
Copy link
Member

@LukasThyWalls If it's not working using custom times, can you try installing a debug version from here and see if the issue has been resolved in it. I just built it from what's currently the most recent version in the repo (031ef74). It should install alongside the release version.

@LukasThyWalls
Copy link
Author

Is this only using "Times from sun" or using custom times, as well?

Both. When i saw the comment, i tested putting some time near to actual time and nothing happens at reach, during and finishing the limits configured. The times set automaticly by location are correct, anyway.

My phone has default function to don't keep alive apps, but Red Moon is configured as protected app and this shouldn't be a problem.

I'm not 100% sure, but Red Moon should work without this.
Better to keep it protected while we're trying to work this out, though :)

Yes, normally i have issues with old apps or not well prepared ones. And with some old apps still have issues with that althought they are in protected apps list. For example, with Twilight i have problems if i dont put it in protected apps (it doesn't start and doesn't do anything, until i enter again in the app). Thats way i pointing that out, because is a normal issue with my phone, if i don't put the options for autostart and keep alive when screen goes off (both disabled by default), "resident apps" doesn't do the things should they be doing.


To be sure: To configure the app to automatic put the red filter on/off in the configured times, the time function has to be activated, but what with the main switch? In my case, like i said, the configured times doesn't matter, if the main switch is on the filter is on, and when is off is off, and it doesn't auto switch or anything.

@LukasThyWalls
Copy link
Author

I tested the debug version, without any luck.

Steps i did:

  • Installed debug version, put it as protected app, i used too "Keep Screen On" app to keep the screen on to see if something happens to the phone.
  • At 23:40, i activated time function, and i put manual times as 23:45 and 00:00.
  • If i switch on the main button, the filter switchs on, so i kept it off (i want to it put the red filter on automatically).
  • At 23:50, the filter is still off. I enter in the app and put the main switch on (the filter is on now).
  • At 00:01, the filter is still on. I enter in the app to put it off with the main switch, or the red filter will be always on.

@smichel17
Copy link
Member

smichel17 commented Apr 8, 2017

In v2.10.0, I removed the floating button and moved its functionality to the top switch. I also removed "disable everything" functionality, which was confusing for many people and no longer needed, since now the timer has its own switch.

That is to say, the current top switch only affects whether Red Moon is turned on and filtering your screen; the timer is completely separate.

I wonder if this is related to #130. Are you able to get a logcat?

@smichel17
Copy link
Member

@LukasThyWalls It's a long shot, but can you see if this works?

  • Set timer for one minute from now
  • Return to the main screen
  • Use the top switch to turn red moon on and then off
  • Wait 60 seconds
    • This is because the timer gets scheduled to the same second of the minute that you're currently at. So, when you set the timer for one minute from now, you need to wait a full 60 seconds, not just until the minute changes.

@LukasThyWalls
Copy link
Author

LukasThyWalls commented Apr 8, 2017

Avoiding misunderstandings, i test a bunch of examples:

  • At 17:08, i put timers to 17:08 - 00:00. After, i use main top switch on/off and wait until 17:09. Nothing happened.
  • At 17:09, i put timers to 17:10 - 17:11. After, i use main top switch on/off and wait until 17:12. Nothing happened.
  • At 17:21, i put timers to 17:23 - 17:25. After, i use main top switch on/off and wait until 17:28. Nothing happened.

I wonder if this is related to #130. Are you able to get a logcat?

I can't get a logcat because i don't have the phone rooted. If a Red Moon debug version have some ability to dump its logcat can be useful, because unrooted android 4.1+ only an app can see its own parts of logcat. is it stored somewhere?

But my problem is the opposite of #130, Master switch is working perfectly, the timers are what aren't doing anything.

@smichel17
Copy link
Member

I can't get a logcat because i don't have the phone rooted. If a Red Moon debug version have some ability to dump its logcat can be useful, because unrooted android 4.1+ only an app can see its own parts of logcat. is it stored somewhere?

Currently Red Moon doesn't have a way to dump its log. I probably won't add that because I'd either need to add an additional permission (to dump the logcat) or add database logging (more work than I'd like to do, given I don't plan to add much more to Red Moon after v3.0 becomes stable).

You can get a logcat from an un-rooted phone using adb on your computer. First, turn on Settings > Developer options > USB debugging. In order to make the Developer options section appear, open Settings > About device and tap Build number a bunch of times (7 or 8 I think). Plug your phone in to your computer and open Red Moon. Then, you have two options:

  1. Use Android studio. I'd recommend this if you're not comfortable using the command line/terminal.
    • Download and install android studio. It will guide you through installing the sdk platform tools.
    • Create a new project or open an existing one. It doesn't matter what, we just want to get to the project view.
    • Click Android monitor in the bottom left
    • Select your phone and the Red Moon process
  2. Use the Android Sdk platform tools. I'd recommend this if you've used
    • Download and extract the platform-tools
    • cd into the directory you just extracted. The adb executable should be there
    • run adb shell
    • run ps | grep redmoon
      • You'll get something like
        u0_a68 2289 1293 1692812 65472 ep_poll 0000000000 S com.jmstudios.redmoon.debug
        The second field (2289) is the process id.
    • run logcat --pid=2289 < replace with your process id

But my problem is the opposite of #130, Master switch is working perfectly, the timers are what aren't doing anything.

There are four things it might be:

  • Alarm is not getting scheduled correctly (unlikely)
  • Alarm is not getting received
  • Alarm is getting received but the signal to turn on is not getting sent (same as Master on/off not working #130)
    • All of the places you can turn Red Moon on/off (master switch, timer, pause in secure apps, widget, notification) pretty much use the same method.
  • Signal to turn on is sent but ignored for some reason.

@LukasThyWalls
Copy link
Author

unfortunaly, i just pointing out that this UI "EMUI" and this official Android Version haven't USB debugging like others. I used ADB in my old phone (to root it), but this one is not that easy. I will try to do it but i need more time to learn to do it or find an alternative or root it (i doesn't need to root the phone until this thing)

@smichel17
Copy link
Member

unfortunaly, i just pointing out that this UI "EMUI" and this official Android Version haven't USB debugging like others

Ah, I see.

Adding full logging is still more work than I'd like to do, but I should be able to do something like show a toast with the relevant information for figuring out this bug. I should have time for that on Friday.

Do you know if this issue was present on v2.9.2 or earlier?

@LukasThyWalls
Copy link
Author

Do you know if this issue was present on v2.9.2 or earlier?

Tested with 2.9.0 and i have the same behaviour... Manual timer doesn't do anything, floating button (in this case) is the only one to switch on/off the red filter.

@LukasThyWalls
Copy link
Author

LukasThyWalls commented Apr 10, 2017

I just find the way to use ADB in my phone... a bit weird way http://www.syncios.com/android/how-to-debug-huawei-ascend-phone.html


At 16:07 i put the timers with 16:09-16:10 with the app opened all the time (and main switch always off). Nothing happened with the red filter, of course.

Note: I can't use logcat --pid=xxxx, it said invalid parameter, i used logcat | grep xxxx instead:

$ps | grep redmoon
u0_a339   18633 2441  1623604 51700 SyS_epoll_ 0000000000 S com.jmstudios.redmoon.debug

$logcat | grep 18633
int logctl_get(): open '/dev/hwlog_switch' fail -1, 13. Permission denied

Note: log switch off, only log_main and log_events will have logs!
04-10 16:07:47.128 18633 18633 I MainActivity: Got intent
04-10 16:07:47.183 18633 18633 I ThemedAppCompatActivity: onCreate - First creation
04-10 16:07:47.218 18633 18633 I FilterFragment: onResume
04-10 16:07:47.231 18633 18633 I ScreenFilterService: onCreate
04-10 16:07:47.233 18633 18633 I ScreenManager: Found Status Bar Height: 48
04-10 16:07:47.233 18633 18633 I ScreenManager: Found Navigation Bar Height: 72
04-10 16:07:47.233 18633 18633 I ScreenFilterPresenter: Initializing
04-10 16:07:47.235 18633 18633 I ScreenFilterService: onStartCommand(Intent { cmp=com.jmstudios.redmoon.debug/com.jmstudios.redmoon.service.ScreenFilt
erService }, 0, 1
04-10 16:07:47.236 18633 18633 I ScreenFilterService: Recieved flag: -1
04-10 16:07:47.236 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:07:47.321 18633 18633 I ProfileSelectorPreferen: onBindView
04-10 16:07:47.321 18633 18633 I ProfileSelectorPreferen: Starting initLayout
04-10 16:07:47.321 18633 18633 I ProfileSelectorPreferen: Setting remove button
04-10 16:07:47.347 18633 18633 I SeekBarPreference: onBindView
04-10 16:07:47.362 18633 18633 I SeekBarPreference: onBindView
04-10 16:07:47.377 18633 18633 I SeekBarPreference: onBindView
04-10 16:07:47.445 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:07:47.448 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:07:47.451 18633 18633 I ProfileSelectorPreferen: Item 1 selected
04-10 16:07:49.227 18633 18633 I ThemedAppCompatActivity: onCreate - First creation
04-10 16:07:49.259 18633 18633 I LocationUpdateService: Received request
04-10 16:07:49.375 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:07:49.377 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:07:57.902 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:07:58.034 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:07:58.036 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:07:58.037 18633 18633 I RedMoonApplication: onPreferenceChanged: pref_key_custom_start_time
04-10 16:07:58.040 18633 18633 I TimeToggleChangeReceive: Scheduling alarm for java.util.GregorianCalendar[time=1491833398039,areFieldsSet=true,lenien
t=true,zone=Europe/Madrid,firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2017,MONTH=3,WEEK_OF_YEAR=15,WEEK_OF_MONTH=3,DAY_OF_MONTH=10,DAY_OF_YEA
R=100,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=4,HOUR_OF_DAY=16,MINUTE=9,SECOND=58,MILLISECOND=39,ZONE_OFFSET=3600000,DST_OFFSET=3600000]
04-10 16:08:01.884 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:08:01.989 18633 18633 I RedMoonApplication: onPreferenceChanged: pref_key_custom_end_time
04-10 16:08:01.992 18633 18633 I TimeToggleChangeReceive: Scheduling alarm for java.util.GregorianCalendar[time=1491833401991,areFieldsSet=true,lenien
t=true,zone=Europe/Madrid,firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2017,MONTH=3,WEEK_OF_YEAR=15,WEEK_OF_MONTH=3,DAY_OF_MONTH=10,DAY_OF_YEA
R=100,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=4,HOUR_OF_DAY=16,MINUTE=10,SECOND=1,MILLISECOND=991,ZONE_OFFSET=3600000,DST_OFFSET=3600000]
04-10 16:08:01.995 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:08:01.997 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:08:04.365 18633 18633 I FilterFragment: onResume
04-10 16:08:04.392 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:08:04.396 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:08:04.648 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:08:06.949 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:08:06.952 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:12:55.064  2929 22015 I AGNSSCONTROL: static void PACommMgr::PAInjectEphemeris(SUPL_GPS_ASSISTANCE_DATA*) -- 1490: svid:4, acc:0, iode2:41, i
ode3:41, m0:-1041474818.000000, delta_n:13427.000000, ecc:42309546.000000, ek:0.000000, sqrt_a:2702035964.000000, omega_0:-418633756.000000, i0:647283
962.000000, omega:368813675.000000, omega_dot:-22830.000000, i_dot:-1040.000000

I tried to do more test, but i realized that if i clean Red Moon from recent apps it is killed (seems the app is not really protected):

04-10 16:19:15.347 18633 18633 I HwSecImmHelper: mSecurityInputMethodService is null
04-10 16:19:15.357 18633 18633 I ScreenFilterService: onDestroy
04-10 16:19:15.359 18633 18633 I ScreenFilterPresenter: Sending update broadcast
04-10 16:19:15.359 18633 18633 I SendBroadcastPermission: action:com.jmstudios.redmoon.action.APPWIDGET_UPDATE, mPermissionType:0
04-10 16:19:15.366  4073  5056 I PgedBinderListener: kstate callback type:8 value1=18633 value2=KILLED
04-10 16:19:15.440  3257  3854 I MediaProcessHandler: processOp opType: 1, uid: 10339, pid: 18633
04-10 16:19:15.440  3257  3854 W MediaProcessHandler: remove target not exist, maybe the UI process: uid: 10339, pid: 18633

And then ps | grep redmoon is empty

@smichel17
Copy link
Member

smichel17 commented Apr 10, 2017

Okay. It looks like the alarm we set never triggers.

I have enough information now to find out how to fix this, if it is possible.

@smichel17 smichel17 added the android Requires android-specific knowledge. Generally also implies 'hard'. label Apr 17, 2017
@smichel17
Copy link
Member

smichel17 commented Apr 17, 2017

Hmm. This problem (AlarmManager not working) usually happens when an app is not protected; I can't find anything about having this problem when the app is protected.

Just to make sure we're talking about the same thing: When you say "Protected", you mean Settings > Advanced Settings > Battery Manager > Protected apps, correct?

@LukasThyWalls
Copy link
Author

Just to make sure we're talking about the same thing: When you say "Protected", you mean Settings > Advanced Settings > Battery Manager > Protected apps, correct?

Correct. And Red Moon is "Protected".

@smichel17
Copy link
Member

smichel17 commented Apr 20, 2017

I'm not really sure what to do about this. If anybody else knows more about why AlarmManager would not work even when Red Moon is protected / knows what to do to fix this, please chime in.

@smichel17
Copy link
Member

smichel17 commented Apr 22, 2017

@LukasThyWalls Do you know if the timer has worked in past versions? Particularly v2.9.2 or earlier.

@LukasThyWalls
Copy link
Author

I was trying to use Red Moon since some time ago, testing the new versions updated in f-droid, but in anyone of them the timer worked. Maybe if you want to test some particular version to view what happens, i can do that.

@smichel17
Copy link
Member

The timer seems to have stopped working on my phone on v3.0.0. Haven't had a chance to look into it yet, but maybe this is the same thing.

@LukasThyWalls
Copy link
Author

LukasThyWalls commented Apr 24, 2017

I have tried to use Red Moon installing via f-droid, and for sure i had installed at least some 2.9.x versions and all 2.10.x versions, and the timer never worked. Maybe is related, but my problem with it is from older versions than v3.0.0.

@smichel17
Copy link
Member

smichel17 commented Apr 29, 2017

@LukasThyWalls New debug build (from fc15476) might fix this.

Edit: That build is actually bugged, working on a fix..

@LukasThyWalls
Copy link
Author

I installed and tried the usual tests, and i don't see any difference with older builds.

A logcat should be useful?

@smichel17
Copy link
Member

No need for a logcat until I've fixed all the bugs I can reproduce :)

@smichel17
Copy link
Member

I'm pretty sure #144 is the same issue as this. That issue is a bit more specific and technical, so I'm going to close this one; If I fix that issue but it doesn't work for you, I'll re-open this.

@smichel17 smichel17 removed the android Requires android-specific knowledge. Generally also implies 'hard'. label Dec 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants