flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.62k stars 27.34k forks source link

Blank page Application when change permission manually #22198

Closed rickyazhari closed 6 years ago

rickyazhari commented 6 years ago

Hi, i made porting to native function to open application info for changing permission need manually straight from the app.

Application info open as expected but when the permission value changes and back in to application. the app just showing blank page. Here reactions from 2 devices.

IOS => Back to app just show blank page after while application restart ANDROID => Back to app just show blank page and there is no other activity after that.

i try to catch with debug logging, but after back to application, debug log just said lost connection to device.

flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.8.2, on Mac OS X 10.13.6 17G65, locale en-ID)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[!] iOS toolchain - develop for iOS devices (Xcode 10.0)
    ! CocoaPods out of date (1.5.0 is recommended).
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To upgrade:
        brew upgrade cocoapods
        pod setup
[✓] Android Studio (version 3.0)
[!] VS Code (version 1.27.2)
[✓] Connected devices (3 available)

! Doctor found issues in 2 categories.
ITID000419-MAC:tanamduit-app-ios lumos$
zoechi commented 6 years ago

If you use flutter logs after the crash, do you get any relevant debug output?

rickyazhari commented 6 years ago

here the logs in moment i change permission manually from setting

[HID] [MT] dispatchEvent Dispatching event with 1 children, _eventMask=0x863 _childEventMask=0x843 Cancel=0 Touching=1 inRange=1
[SpringBoard:52] Attempting to acquire assertion for Preferences:1428: <BKProcessAssertion: 0x115d61ec0; "com.apple.UIKit.KeyboardManagement.message" (finishTask:180s); id:…08E291697F34>
[Preferences:1428] Add assertion: <BKProcessAssertion: 0x115d61ec0; id: 52-777B47A0-1D8F-447C-8F68-08E291697F34; name: com.apple.UIKit.KeyboardManagement.message; state: active; reason: finishTask; duration: 180.0s> {
    owner = <BSProcessHandle: 0x115d13eb0; SpringBoard:52; valid: YES>;
    flags = preventSuspend, preventThrottleDownUI, preventThrottleDownCPU, preventSuspendOnSleep;
}
[Preferences:1428] Activate assertion: <BKProcessAssertion: 0x115d61ec0; "com.apple.UIKit.KeyboardManagement.message" (finishTask:180s); id:…08E291697F34>
[Preferences:1428] Setting jetsam priority to 10 [0x10108]
Client relinquished <BKProcessAssertion: 0x115d61ec0; "com.apple.UIKit.KeyboardManagement.message" (finishTask:180s); id:…08E291697F34>
[Preferences:1428] Deactivate assertion: <BKProcessAssertion: 0x115d61ec0; "com.apple.UIKit.KeyboardManagement.message" (finishTask:180s); id:…08E291697F34>
[Preferences:1428] Setting jetsam priority to 10 [0x10100]
[Preferences:1428] Remove assertion: <BKProcessAssertion: 0x115d61ec0; "com.apple.UIKit.KeyboardManagement.message" (finishTask:180s); id:…08E291697F34>
-[BKAssertion dealloc] - <0x115d61ec0>
[HID] [MT] dispatchEvent Dispatching event with 1 children, _eventMask=0x23 _childEventMask=0x3 Cancel=0 Touching=0 inRange=0
@ClxLink, Nearby, 0
#Warning Spectator subscriptions expired
coarse elevation src,enable,<private>,elevationSpectator,<private>,fitnessTracking,<private>
Client request for IDSCopyLocalDeviceUniqueID: <private>
Terminating com.tanamduit.ios[1454] because access to the kTCCServiceCamera service changed.
Created BKApplicationStateServerClient for [1169:<private>] -> <private>
########### Quitting application (com.tanamduit.ios) in response to privacy settings change.
TileCell, unexpected, companion, 5
<private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>
Sending new config to Oscar: enableActivity,<private>,enableStepCounting,<private>,activityForceCodeTransition,<private>,stepCountingForceCodeTransition,<private>,enableThreshold,<private>,enableOnBodyDetection,<private>,disableDynamicBias,0,ispEnable,0,ispMode,0,logLevel,-1,enableUrgentCal,0,stickyIsp,0,enableCoarseElevation,<private>,captureMode,4
[Runner:1454] SyscallError: setpriority(PRIO_DARWIN_ROLE, 1454, 3): No such process
connection invalidated
<private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>
Sending new config to Oscar: enableActivity,<private>,enableStepCounting,<private>,activityForceCodeTransition,<private>,stepCountingForceCodeTransition,<private>,enableThreshold,<private>,enableOnBodyDetection,<private>,disableDynamicBias,0,ispEnable,0,ispMode,0,logLevel,-1,enableUrgentCal,0,stickyIsp,0,enableCoarseElevation,<private>,captureMode,4
<private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>
Sending new config to Oscar: enableActivity,<private>,enableStepCounting,<private>,activityForceCodeTransition,<private>,stepCountingForceCodeTransition,<private>,enableThreshold,<private>,enableOnBodyDetection,<private>,disableDynamicBias,0,ispEnable,0,ispMode,0,logLevel,-1,enableUrgentCal,0,stickyIsp,0,enableCoarseElevation,<private>,captureMode,4
<private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>
Sending new config to Oscar: enableActivity,<private>,enableStepCounting,<private>,activityForceCodeTransition,<private>,stepCountingForceCodeTransition,<private>,enableThreshold,<private>,enableOnBodyDetection,<private>,disableDynamicBias,0,ispEnable,0,ispMode,0,logLevel,-1,enableUrgentCal,0,stickyIsp,0,enableCoarseElevation,<private>,captureMode,4
<private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>, <private>
Sending new config to Oscar: enableActivity,<private>,enableStepCounting,<private>,activityForceCodeTransition,<private>,stepCountingForceCodeTransition,<private>,enableThreshold,<private>,enableOnBodyDetection,<private>,disableDynamicBias,0,ispEnable,0,ispMode,0,logLevel,-1,enableUrgentCal,0,stickyIsp,0,enableCoarseElevation,<private>,captureMode,4
Removed BKApplicationStateServerClient for [1169:<private>] -> <private>
Failed to read favorites file /var/mobile/Library/Preferences/com.apple.mobilephone.speeddial.plist, error: Error Domain=NSCocoaErrorDomain Code=260 UserInfo={NSFilePath=<private>, NSUnderlyingError=0x100261550 {Error Domain=NSPOSIXErrorDomain Code=2}}
Completed XPC Activity: com.apple.dataaccess.dataaccessd.fetch.EA3A791A-FE90-4581-83DC-FDDA45159A3C
[Runner:1454] Port death watcher fired.
COMPLETED com.apple.dataaccess.dataaccessd.fetch.EA3A791A-FE90-4581-83DC-FDDA45159A3C:049A68 <private>!
NO LONGER RUNNING com.apple.dataaccess.dataaccessd.fetch.EA3A791A-FE90-4581-83DC-FDDA45159A3C:049A68 ...Tasks running in group [com.apple.dasd.defaultNetwork] are 1!
Process exited: <BKProcess: 0x115e98900; Runner; com.tanamduit.ios; pid: 1454; agency: Application; visibility: none; task: none; hostpid: 52>
Rescheduling XPC Activity: com.apple.dataaccess.dataaccessd.fetch.EA3A791A-FE90-4581-83DC-FDDA45159A3C
[Runner:1454] Invalidating...
SUBMITTING: <private>
Submitted Activity: com.apple.dataaccess.dataaccessd.fetch.EA3A791A-FE90-4581-83DC-FDDA45159A3C:BD3849 <private>
Activity <private>: Optimal Score 0.5068 at <private> (Valid Until: <private>)
PID[1171] is checking access for target PID[1172]
Granting PID[1172] access to kTCCServiceLiverpool via entitlement 'com.apple.private.tcc.allow'
Didn't get a service identity from the PCS framework
"<private> (<private>) received"
handle_get_value: <private>
Received darwin notification com.apple.tcc.access.changed
handle_get_value: <private>
"SecItemCopyMatching result: -25300 - keychain item com.apple.appleaccount.cloudkit.token - username <private>"
Will start indexing with client state: <private>
No contact changes to index
Starting family request: <private>
"<private> (<private>) received"
Access to fitness data granted.
<HDPedometerDataCollector: 0x1012a1670>: Transitioning collection type from Passive -> Passive
"The connection to ACDAccountStore was invalidated."
Skipping server fetch of family circle as the cache is fresh (Fri Sep 21 11:49:00 2018)
Family request responsed with response: <private> - <private> - (null)
"<private> (<private>) received"
"The connection to ACDAccountStore was invalidated."
"The connection to ACDAccountStore was invalidated."
PPPortrait loaded 1 disabled bundleIds from CloudKit prefs.
[Runner:1454] Got exit context: <BKSProcessExitContext: 0x115e35ca0; reason: (none)>
<FBApplicationProcess: 0x12f1c23b0; Runner (com.tanamduit.ios); pid: 1454> assertiond says the process actually exited with context: <BKSProcessExitContext: 0x283e97140; reason: (none)>
<FBApplicationProcess: 0x12f1c23b0; Runner (com.tanamduit.ios); pid: 1454> exited.
Removing: <FBApplicationProcess: 0x12f1c23b0; Runner (com.tanamduit.ios); pid: 1454>
[Runner:1454] Terminating because the job-submitter has disconnected.
Process exited: <FBApplicationProcess: 0x12f1c23b0; Runner (com.tanamduit.ios); pid: -1> -> <FBApplicationProcessExitContext: 0x2832fe340; exitReason: (none); terminationReason: (none)> {
    stateAtExit = <FBProcessState: 0x283cb64e0; pid: 1454; taskState: Not Running; visibility: Unknown>;
}
Deleted job with label: UIKitApplication:com.tanamduit.ios[0x69eb][62]
lock/volume priority is:volume
reconfigured lock button: <SBMutableHardwareButtonGestureParameters: 0x282945340; maximumPressCount: 1; longPressTimeInterval: 2.50s;multiplePressTimeInterval: 0.30s>
lock/volume priority is:volume
Application process state changed for com.tanamduit.ios: (null)
[Runner:1454] Deleted launchd job with label: UIKitApplication:com.tanamduit.ios[0x69eb][62]
POSM disabled...
[Runner:1454] Invalidation complete.
L2 Metrics on ifname en0: rssi: -55 (txFrames/txReTx/txFail) 4/0/0 -> (was/is) 0/0
Checking for deferred bootstrap request for com.tanamduit.ios
[Runner:1454] Removing client: <BKProcessInfoServerClient: 0x115e69fc0; pid: 52>
[Runner:1454] No clients remain.
-CMSessionMgr- CMSessionMgrHandleApplicationStateChange: CMSession: Client com.tanamduit.ios with pid '1454' is now Terminated. Background entitlement: NO
#I BundleID: <private> is no longer a foreground app
{"msg":"adapter details", "adapterDescription":"usb host", "batteryChargerType":"kChargerTypeUsb"}
{"msg":"state transition", "event":"state_transition", "state":"DaemonStatus", "id":"0x102b316d0", "property":"batteryData", "old":{"wasConnected":true,"charged":false,"level":37,"connected":true,"chargerType":"kChargerTypeUsb"}, "new":{"wasConnected":true,"charged":false,"level":38,"connected":true,"chargerType":"kChargerTypeUsb"}}
WIFI PICKER [com.tanamduit.ios]: isProcessLaunch: 0,    isForegroundActivation: 0,     isForegroundDeactivation: 0
#I BundleID: <private> is no longer a foreground app
1454 com.tanamduit.ios: Terminated (most elevated: Terminated)
Entry, display name com.tanamduit.ios uuid (null) pid 1454 isFront 0
Battery capacity change posted(0xb0026). Capacity:38 Source:AC
Battery time remaining posted. Capacity:38
Power sources changed
Query power sources
Got a list of 1 sources
Found 1 power sources
Found power source: {
    "Battery Provides Time Remaining" = 1;
    BatteryHealth = Good;
    "Current Capacity" = 38;
    "Is Charging" = 1;
    "Is Finishing Charge" = 0;
    "Is Present" = 1;
    "Max Capacity" = 100;
    Name = "InternalBattery-0";
    "Power Source ID" = 2293859;
    "Power Source State" = "AC Power";
    "Raw External Connected" = 1;
    "Show Charging UI" = 1;
    "Time to Empty" = 0;
    "Time to Full Charge" = 0;
    "Transport Type" = Internal;
    Type = InternalBattery;
}
Found device: <BCBatteryDevice: 0x2812b0d80; vendor = Apple; productIdentifier = 0; parts = (null); identifier = 2293859; matchIdentifier = (null); name = Ricky’s iPhone; groupName =InternalBattery-0; percentCharge = 38; lowBattery = NO; batterySaverModeActive = NO; connected = YES; charging = YES; internal = YES; powerSource = YES; poweredSoureState = AC Power; transportType = 1; accessoryIdentifier = (null); accessoryCategory = Unknown>
battery info changed to (charging 38) with detail='38%'
{"msg":"Incoming message", "event":"activity", "name":"kCLConnectionMessageMotionActivityQuery", "this":"0x105ce87c0", "registrationReceived":0}
ATXUpdatePredictions: cache age 450.000000, reason 'app was launched'
Trigger: <private> is now [<private>]
Trigger: <private> is now [38]
Local power source updated SFPowerSource 0xF9B4, SID 2293859, AdFm -536854528, ChUI yes, MaxC 100.00%, Typ 'InternalBattery', TPT 'Internal', Nm 'InternalBattery-0', L +38.00%, St Charging, IOPS details SFPowerSource 0xF9B4 {
    "Is Finishing Charge" : false,
    "Is Present" : true,
    "Power Source State" : "AC Power",
    "Max Capacity" : 100,
    "Name" : "InternalBattery-0",
    "Current Capacity" : 38,
    "Battery Provides Time Remaining" : true,
    "Is Charging" : true,
    "Transport Type" : "Internal",
    "Show Charging UI" : true,
    "Time to Empty" : 0,
    "Power Source ID" : 2293859,
    "Type" : "InternalBattery",
    "BatteryHealth" : "Good",
    "Raw External Connected" : true,
    "Time to Full Charge" : 0,
}
Adapter {
    "Amperage" : 2000,
    "Description" : "usb host",
    "FamilyCode" : -536854528,
    "PMUConfiguration" : 1560,
    "AdapterVoltage" : 5000,
    "Watts" : 10,
}

 pipe connected no
handle_get_value: <private>
handle_get_value: <private>
handle_get_value: <private>
handle_get_value: <private>
handle_get_value: <private>
cert[0]: MissingIntermediate =(leaf)[force]> 0
cert[0]: NonEmptySubject =(path)[]> 0
handle_get_value: <private>
handle_get_value: <private>
Sync action handler called
Default paired device: no
cert[0]: MissingIntermediate =(leaf)[force]> 0
cert[0]: NonEmptySubject =(path)[]> 0
handle_get_value: <private>
             EventStatistics.m:48  :   43744.29771:  Info: 3 Digitizer since   43738.19473 (Tue Sep 25 09:59:20 2018)](url)

based on this log

Terminating com.tanamduit.ios[1454] because access to the kTCCServiceCamera service changed.
Created BKApplicationStateServerClient for [1169:<private>] -> <private>

my application has been terminated.

mklim commented 6 years ago

Thanks for the bug report and the logs @rickyazhari.

I think on iOS apps are deliberately restarted by the system itself in response to permission changes. See https://stackoverflow.com/a/29707306 and https://stackoverflow.com/a/12668187 for some explanation and sources. That would explain the ########### Quitting application (com.tanamduit.ios) in response to privacy settings change. log you posted.

Android doesn't do this, so the problem you're seeing there is something else. I added a permission to the basic flutter create app, opened it, toggled the permission in Android settings, and brought the demo back into the foreground to try and test it out. Everything appears to be working fine for me. Could you post some simple example code that causes this problem on Android? Logs would be helpful too.

rickyazhari commented 6 years ago

ok i will try with sample code and thanks for explanation i thought so too about restarting application in ios. but i'll do some sample and my real apps in android. i'll post soon

rickyazhari commented 6 years ago

ok, sorry to take much time to reply,

after i do some sample in android device when redirecting to application info from apps and change permission with case : 1 . off to on : back to application is normal

  1. off to on and back off : back to application and got white blank screen.

here logs in case 2 :

09-27 15:09:39.182 1162-1187/? I/ActivityManager: Displayed com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.ManagePermissionsActivity: +304ms
09-27 15:09:39.190 1162-3651/? D/WindowManager: finishDrawingWindow: Window{25769c3 u0 com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.ManagePermissionsActivity} mDrawState=HAS_DRAWN
09-27 15:09:39.225 1162-8351/? W/AwareLog: AwareMem_Kill: updateGroupList package: not kill critical frequent=org.telegram.messenger, uid=10176
09-27 15:09:39.225 1162-8351/? W/AwareLog: AwareMem_Kill: execKillGroup: null procGroups
09-27 15:09:39.228 8433-8460/? E/asset: createFromFile(): lock file /data/resource-cache/system@emui@base@overlay@frameworkhwexthonor@frameworkhwexthonor.apk@idmap.
09-27 15:09:39.228 8433-8460/? E/asset: createFromFile(): lock file /data/resource-cache/system@emui@base@overlay@frameworkhwexthonor@frameworkhwexthonor.apk@idmap.
09-27 15:09:39.229 8433-8460/? W/ResourceType: Found multiple library tables, ignoring...
09-27 15:09:39.307 1478-1478/? I/NetworkSpeedManagerEx: mIsStop = false
09-27 15:09:39.307 1478-1729/? I/NetworkSpeedManagerEx:  runInThread getTetherStats
09-27 15:09:39.308 1478-1478/? I/NetworkSpeedManagerEx:  runInUI refreshSpeed
09-27 15:09:39.309 1478-1478/? I/NetworkSpeedManagerEx: value=3087.0speed = 3
                                                        K/smIsShowLastSpeedValuefalse
09-27 15:09:39.309 1478-1478/? I/NetworkSpeedView: /update(), speed=3
                                                   K/s parent class:class com.android.systemui.statusbar.HwSystemIcons
09-27 15:09:39.402 1162-1338/? D/ConnectivityService: releasing NetworkRequest [ LISTEN id=929, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ] (CALLBACK_RELEASED)
09-27 15:09:39.585 1621-2026/? I/ScalingFreqAdapterUniPerf: ===success setFreq:  lcpumin:1->480000
09-27 15:09:39.585 670-791/? I/uniperf server: setConfig clientId=1, tagLen=1, tags[0]=1, configs[0]=480000
09-27 15:09:39.585 1621-2026/? I/ScalingFreqAdapterUniPerf: ===success setFreq:  gpumin:7->360000000
09-27 15:09:39.585 1621-2026/? I/ScalingFreqAdapterUniPerf: ===success setFreq:  bcpumin:4->1402000
09-27 15:09:39.585 670-791/? I/uniperf server: setConfig clientId=1, tagLen=1, tags[0]=7, configs[0]=360000000
09-27 15:09:39.585 670-791/? I/uniperf server: setConfig clientId=1, tagLen=1, tags[0]=4, configs[0]=1402000
09-27 15:09:39.658 682-855/? E/BufferQueueProducer: [com.android.settings/com.android.settings.applications.InstalledAppDetails#0] disconnect: not connected (req=1)
09-27 15:09:39.659 8433-8470/? W/libEGL: EGLNativeWindowType 0x72fa9db010 disconnect failed
09-27 15:09:39.669 1162-3651/? V/WindowManager: notifyAppStopped: AppWindowToken{b80e168 token=Token{9630c8b ActivityRecord{782325a u0 com.android.settings/.applications.InstalledAppDetails t2082}}}
09-27 15:09:39.669 1162-3651/? E/WindowManager: win=Window{4bdbc4b u0 com.android.settings/com.android.settings.applications.InstalledAppDetails} destroySurfaces: appStopped=true win.mWindowRemovalAllowed=false win.mRemoveOnExit=false
09-27 15:09:39.670 1162-3651/? I/WindowManager: Destroying surface Surface(name=com.android.settings/com.android.settings.applications.InstalledAppDetails) called by com.android.server.wm.WindowStateAnimator.destroySurface:2060 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:873 com.android.server.wm.HwWindowStateAnimator.destroySurfaceLocked:1006 com.android.server.wm.WindowState.destroyOrSaveSurfaceUnchecked:2990 com.android.server.wm.WindowState.destroySurface:2951 com.android.server.wm.AppWindowToken.destroySurfaces:654 com.android.server.wm.AppWindowToken.destroySurfaces:638 com.android.server.wm.AppWindowToken.notifyAppStopped:682 
09-27 15:09:39.674 1162-1179/? D/HwGameAssistantController: pid=8433, uid=1000, foreground=false
09-27 15:09:39.731 1162-10343/? I/ActivityManager: Process com.android.chrome:sandboxed_process0 (pid 8083) has died: cch  CACC
09-27 15:09:39.732 1162-1180/? W/zygote64: failed to open /acct/uid_99281/pid_8083/cgroup.procs: No such file or directory
09-27 15:09:39.732 1162-10343/? D/ActivityManager: cleanUpApplicationRecord app: ProcessRecord{c845589 8083:com.android.chrome:sandboxed_process0/u0a281i281}, app.bad: false, restarting: false, allowRestart: true
09-27 15:09:39.732 1162-10343/? W/ActivityManager: Scheduling restart of crashed service com.mercatocapitale.tanamduit/org.chromium.content.app.SandboxedProcessService0 in 1000ms
09-27 15:09:39.734 1600-2637/? E/HsmCoreServiceImpl: onTransact in code is: 102
09-27 15:09:39.734 1600-2637/? I/MediaProcessHandler: processOp opType: 1, uid: 10281, pid: 8083
09-27 15:09:39.734 1600-2637/? W/MediaProcessHandler: remove target not exist, maybe the UI process: uid: 10281, pid: 8083
09-27 15:09:39.734 1600-2637/? I/MediaProcessHandler: executedCallBack opType: 1 mMediaStatusObservers.size=0
09-27 15:09:39.743 7760-8080/com.mercatocapitale.tanamduit W/cr_ChildProcessConn: onServiceDisconnected (crash or killed by oom): pid=8083
09-27 15:09:39.783 1621-1847/? I/AppManager: dependence has been existed:7760 -> 3082
09-27 15:09:39.813 7760-8496/com.mercatocapitale.tanamduit W/cr_CrashFileManager: /data/user/0/com.mercatocapitale.tanamduit/cache/WebView/Crash Reports does not exist or is not a directory
09-27 15:09:39.851 1162-1162/? I/MQoS: onSignal: mSubId=1,currDataSubID=1
09-27 15:09:39.851 1162-1162/? I/MQoS: received cell-signal:5
09-27 15:09:39.855 1478-1729/? I/HwMobileSignalController(1): subId:1 phoneType:1 networktype:13 targetClass:3 masterLevel:5 slaveLevel:-1
09-27 15:09:40.034 8433-8460/? E/asset: createFromFile(): lock file /data/resource-cache/system@emui@base@overlay@frameworkhwexthonor@frameworkhwexthonor.apk@idmap.
09-27 15:09:40.034 8433-8460/? E/asset: createFromFile(): lock file /data/resource-cache/system@emui@base@overlay@frameworkhwexthonor@frameworkhwexthonor.apk@idmap.
09-27 15:09:40.035 8433-8460/? W/ResourceType: Found multiple library tables, ignoring...
09-27 15:09:40.044 722-722/? E/Thermal-daemon: [shell_temp] temp_new :40  temp_old :39
09-27 15:09:40.045 1621-2057/? I/ThermalService: Receive temperature change, type: 22, temp: 40 from thermald
09-27 15:09:40.045 1621-2057/? I/ThermalTrace_ThermalRaise: Shell:-100,39,40,currentBatteryTemp:39
09-27 15:09:40.046 1621-2561/? D/HwThermalStateManager: Thermal type: 22 cur_temperature:40
09-27 15:09:40.046 722-722/? E/Thermal-daemon: Report temperature: [shell_temp] temp :40  report_threshold:1
09-27 15:09:40.047 722-722/? E/Thermal-daemon: [pa_0] temp_new :40  temp_old :39
09-27 15:09:40.047 1621-2057/? I/ThermalService: Receive temperature change, type: 1, temp: 40 from thermald
09-27 15:09:40.047 1621-2561/? D/HwThermalStateManager: Thermal type: 1 cur_temperature:40
09-27 15:09:40.047 1621-2561/? W/HwThermalStateManager: warning: no config thermal type:1 temperature:40
09-27 15:09:40.047 722-722/? E/Thermal-daemon: Report temperature: [pa_0] temp :40  report_threshold:1

My assumption base on logs. The os system is trying to restart app cause service value change than the app crash. But why it get blank white page result ?

mklim commented 6 years ago

No problem, thanks for the logs. I was mistaken earlier, looks like Android actually terminates apps in response to permissions being revoked. Sorry about that. I'm having trouble finding documentation on this, but I'm seeing it happen with my tester app too. I'm not 100% sure of this, but from what I can tell the app isn't being restarted on Android, it's just being stopped until it's opened again.

Not sure about the white screen you're seeing, and unfortunately I'm not getting any useful information from the logs to help debug it further. Could you upload some simple example code that reproduces this problem?

rickyazhari commented 6 years ago

here's i provide sample app to replicate this issue main.dart

import 'package:flutter/material.dart';
import 'package:tanamduit_porting_collections/tanamduit_porting_collections.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new InputField()
    );
  }
}

class InputField extends StatelessWidget{

  @override
  Widget build(BuildContext context){
    TanamduitPortingCollections collections = new TanamduitPortingCollections();
    return new Scaffold(
      body: new Center(
        child: new GestureDetector(
          onTap: () async{
              collections.goToSettingPermission(
                packageName: "com.example.sampleimagecache",
                request: "request"
              ); 
          },
          child: new Container(
            width: 200.0,
            height: 75.0,
            color: const Color(0xFF575757),
            child: new Text(
              "Button",
              style: new TextStyle(
                color: const Color(0xFFFFFFFF),
                fontSize: 16.0,
                fontWeight: FontWeight.w500
              ),
            ),
          ),
        ),
      ),
    );
  }
}

plugin tanamduit_porting_collections lib

Future<bool> goToSettingPermission({
    String packageName,
    String request
  }) async{
    final args = {};
    args['package'] = packageName;
    args['request'] = request;
    return await _channel.invokeMethod("goToSetting",args);
  }

porting android

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
  private void goToSetting(MethodCall call){
    String pkg = call.argument("package");
    String requestSection = call.argument("request");

    if(pkg != null) {
      Intent setting = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + pkg));
      setting.addCategory(Intent.CATEGORY_DEFAULT);
      vAct.startActivityForResult(setting,100);
    }else {
      vResult.error("Invalid Package name", "Pckage name not found", null);
    }
  }

porting ios

-(void) goToSetting :(FlutterResult)result{
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
    result(@YES);
}

thanks for your help

mklim commented 6 years ago

Thanks for the code!

So unfortunately I'm still not seeing the issue. How are you populating vAct and vResult in the Android example plugin? I'm using this:

  TanamduitPortingCollections(Activity activity) {
    this.vAct = activity;
  }

  /** Plugin registration. */
  public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "test_plugin");
    channel.setMethodCallHandler(new TestPlugin(registrar.activity()));
  }

  @Override
  public void onMethodCall(MethodCall call, Result result) {
    vResult = null;
    if (call.method.equals("goToSetting")) {
      vResult = result;
      goToSetting(call);
    } else {
      result.notImplemented();
    }
  }

I'm seeing the app reload when I navigate back to it from the permissions screen after disabling the permission, but it is reloading correctly and drawing the button again instead of hanging.

rickyazhari commented 6 years ago

Sorry for late reponds hmm interesting. in application settings, did you change permission value from off to on and then change again to from on to off. In my case i've got blank page result. i will provide some gift.

rickyazhari commented 6 years ago

Ok, i do some test with my apps. it seems not blank screen anymore. i confirmed android os restarting the application cause changing permission service. We can close this issue thanks for keep patience and your support.

keep up the good work

mklim commented 6 years ago

Glad it's been resolved for you. Thanks for reaching out!

sajaadem commented 3 years ago

@rickyazhari could you tell us how you resolved the issue please ?

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.