Jump to content
Sign in to follow this  
Yaron

Supporting clients using the Android platform (gray screen issue)

Recommended Posts

I am developing a cross-platform remote control app for my Windows PC media player:

https://play.google.com/store/apps/details?id=com.inmatrix.ZP_Remote

 

However, I have a user running Android 9 that reports that right after the splash screen (delphi's built-in splash screen, no custom code), all they see is a gray screen. Since the user is on a rooted phone, I provided a debug APK with code that outputs progress to a log file, however the log file is never created.

 

The only thing I can compare it to is trying to run the App on the Nox emulator running Android 7, which instantly crashes after the splash screen without reaching the first line of code on even a blank application (new multi-device application, with no additional code):

 

 

Here is the pertinent code that should at least output one line of debug code (which works just fine on all devices I could test locally):

 

program ZP_Remote;

{$R *.dres}

uses
  FMX.Forms,
  FMX.Types,
  misc_functions,
  System.IOUtils,
  System.SyncObjs,
  MainUnit in 'MainUnit.pas' {MainForm},
  transunit in 'transunit.pas';

{$R *.res}

begin
  csDebug := TCriticalSection.Create;
  clientStopWatch.Start;
  UserDataPath := System.IOUtils.TPath.GetHomePath+System.IOUtils.TPath.DirectorySeparatorChar+clientName+System.IOUtils.TPath.DirectorySeparatorChar;
  {$IFDEF TRACEDEBUG}AddDebugEntry('DPR:Start');{$ENDIF}
  FMX.Types.GlobalUseGPUCanvas  := True; // 25->840fps! but messes with font rendering?!?

  Application.Initialize;
  {$IFDEF TRACEDEBUG}AddDebugEntry('DPR:Initialized');{$ENDIF}
  Application.FormFactor.Orientations := [TFormOrientation.Portrait];
  {$IFDEF TRACEDEBUG}AddDebugEntry('DPR:Form orientation set');{$ENDIF}
  Application.CreateForm(TMainForm, MainForm);
  {$IFDEF TRACEDEBUG}AddDebugEntry('DPR:Form created, ready to run');{$ENDIF}
  Application.Run;
  {$IFDEF TRACEDEBUG}AddDebugEntry('DPR:Last line');{$ENDIF}
end.

 

And here is the code that writes the debug output:
 

    procedure AddDebugEntry(S : String);
    const
      UTF8BOM  : Array[0..2] of Byte = ($EF,$BB,$BF);
    Var
      FileName : String;
      fStream  : TFileStream;
      sAnsi    : UTF8String;
      S1       : String;
      
    begin
        If csDebug <> nil then csDebug.Enter;
        Try
          if UserDataPath <> '' then
          Begin
            FileName := UserDataPath+clientDebugFile;
            If FileExists(FileName) = True then
            Begin
              Try fStream := TFileStream.Create(FileName,fmOpenWrite); Except fStream := nil; End;
            End
              else
            Begin
              Try
                fStream := TFileStream.Create(FileName,fmCreate);
                fStream.Write(UTF8BOM,3);
              Except
                fStream := nil;
              End;
            End;
            If fStream <> nil then
            Begin
              S1 := IntToStr(clientStopWatch.ElapsedMilliseconds);
              While Length(S1) < 12 do S1 := ' '+S1;
              S  := {$IFDEF DEBUGDATE}DateToStr(Date)+' '+TimeToStr(Time)+' '+{$ENDIF}'['+S1+'] : '+S;

              sAnsi := UTF8Encode(S)+#13#10;
              fStream.Seek(0,soFromEnd);
              fStream.Write(sAnsi[Low(sAnsi)],Length(sAnsi));
              fStream.Free;
            End;
          End;
        Finally
          If csDebug <> nil then csDebug.Leave;
        End;
    end;

 

I welcome any advice on the best practices to diagnose and resolve such issues when access to the devices is severely limited.

Share this post


Link to post

I was able to obtain some logcat/event, any idea what's going on?
 

Logcat:

05-13 16:00:47.545 I/ActivityManager( 1383): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity bnds=[37,1730][238,2028]} from uid 10015
05-13 16:00:47.636 I/ActivityManager( 1383): Start proc 14206:com.inmatrix.ZP_Remote/u0a227 for activity com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity
05-13 16:00:48.297 W/linker  (14206): Warning: "/data/app/com.inmatrix.ZP_Remote-S-1zk8LZ5cw0Sxl-7bv-GA==/lib/arm/libZP_Remote.so" unused DT entry: DT_RPATH (type 0xf arg 0x145ae) (ignoring)
05-13 16:00:49.598 D/SurfaceFlinger(  814): duplicate layer name: changing SurfaceView - com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity to SurfaceView - com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity#1
05-13 16:00:49.599 D/SurfaceFlinger(  814): duplicate layer name: changing Background for -SurfaceView - com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity to Background for -SurfaceView - com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity#1
05-13 16:00:49.994 I/ActivityManager( 1383): Displayed com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity: +2s446ms
05-13 16:00:50.100 W/SurfaceFlinger(  814): Attempting to set client state on removed layer: Splash Screen com.inmatrix.ZP_Remote#0
05-13 16:00:50.100 W/SurfaceFlinger(  814): Attempting to destroy on removed layer: Splash Screen com.inmatrix.ZP_Remote#0
05-13 16:00:57.071 E/BufferQueueProducer(  814): [SurfaceView - com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity#1] disconnect: not connected (req=1)
05-13 16:00:58.326 W/InputDispatcher( 1383): channel '3be32e5 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
05-13 16:00:58.326 E/InputDispatcher( 1383): channel '3be32e5 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
05-13 16:00:58.329 I/ActivityManager( 1383): Process com.inmatrix.ZP_Remote (pid 14206) has died: cch  CRE 
05-13 16:00:58.329 I/WindowManager( 1383): WIN DEATH: Window{3be32e5 u0 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity}
05-13 16:00:58.329 W/InputDispatcher( 1383): Attempted to unregister already unregistered input channel '3be32e5 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity (server)'
05-13 16:00:58.349 W/SurfaceFlinger(  814): Attempting to destroy on removed layer: AppWindowToken{58e86aa token=Token{2ad595 ActivityRecord{e1ab14c u0 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity t9944}}}#0 

 

Events:

05-13 15:56:13.909 I/am_create_activity( 1383): [0,177586847,9925,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,android.intent.action.MAIN,NULL,NULL,270532608]
05-13 15:56:13.971 I/am_proc_start( 1383): [0,11738,10227,com.inmatrix.ZP_Remote,activity,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity]
05-13 15:56:14.131 I/am_proc_bound( 1383): [0,11738,com.inmatrix.ZP_Remote]
05-13 15:56:14.143 I/am_restart_activity( 1383): [0,177586847,9925,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity]
05-13 15:56:14.145 I/am_set_resumed_activity( 1383): [0,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,minimalResumeActivityLocked]
05-13 15:56:16.473 I/sysui_multi_action( 1383): [319,268,321,116,322,2583,325,94229,757,761,758,7,759,1,806,com.inmatrix.ZP_Remote,871,com.embarcadero.firemonkey.FMXNativeActivity,904,com.google.android.apps.nexuslauncher,905,0,945,247,1320,12,1321,1]
05-13 15:56:16.475 I/am_activity_launch_time( 1383): [0,177586847,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,2583]
05-13 15:56:22.553 I/am_finish_activity( 1383): [0,177586847,9925,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,app-request]
05-13 15:56:22.555 I/am_pause_activity( 1383): [0,177586847,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,userLeaving=false]
05-13 15:56:23.195 I/am_destroy_activity( 1383): [0,177586847,9925,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,finish-imm:activityIdleInternalLocked]
05-13 15:56:24.232 I/am_proc_died( 1383): [0,11738,com.inmatrix.ZP_Remote,900,17]
05-13 16:00:47.559 I/am_create_activity( 1383): [0,236630348,9944,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,android.intent.action.MAIN,NULL,NULL,270532608]
05-13 16:00:47.636 I/am_proc_start( 1383): [0,14206,10227,com.inmatrix.ZP_Remote,activity,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity]
05-13 16:00:47.854 I/am_proc_bound( 1383): [0,14206,com.inmatrix.ZP_Remote]
05-13 16:00:47.865 I/am_restart_activity( 1383): [0,236630348,9944,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity]
05-13 16:00:47.865 I/am_set_resumed_activity( 1383): [0,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,minimalResumeActivityLocked]
05-13 16:00:49.993 I/sysui_multi_action( 1383): [319,336,321,104,322,2446,325,94503,757,761,758,7,759,1,806,com.inmatrix.ZP_Remote,871,com.embarcadero.firemonkey.FMXNativeActivity,904,com.google.android.apps.nexuslauncher,905,0,945,311,1320,12,1321,1]
05-13 16:00:49.994 I/am_activity_launch_time( 1383): [0,236630348,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,2446]
05-13 16:00:56.363 I/am_finish_activity( 1383): [0,236630348,9944,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,app-request]
05-13 16:00:56.365 I/am_pause_activity( 1383): [0,236630348,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,userLeaving=false]
05-13 16:00:56.987 I/am_destroy_activity( 1383): [0,236630348,9944,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,finish-imm:activityIdleInternalLocked]
05-13 16:00:58.329 I/am_proc_died( 1383): [0,14206,com.inmatrix.ZP_Remote,900,17] 

 

Share this post


Link to post

Please ignore this post, the issue was a combination of a bug and the user's inability to find the output log.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×