Closed Serchinastico closed 7 years ago
It fixes my issue ! Thank you so much
My activity manager state is now:
TASK com.karumi.dexter.sample id=2446
ACTIVITY com.karumi.dexter.sample/.SampleActivity e51737a pid=20332
Local Activity a2e5fc3 State:
mResumed=true mStopped=false mFinished=false
mChangingConfigurations=false
mCurrentConfig={0 1.0 themeSeq = 0 showBtnBg = 0 208mcc1mnc [en_US] ldltr sw360dp w360dp h668dp 480dpi nrml long port ?dc finger -keyb/v/h -nav/h mkbd/h desktop/d s.74}
threadConfig={0 1.0 themeSeq = 0 showBtnBg = 0 208mcc1mnc [en_US] ldltr sw360dp w360dp h668dp 480dpi nrml long port ?dc finger -keyb/v/h -nav/h mkbd/h desktop/d s.74} isDexCompatMode=false
mLoadersStarted=true
FragmentManager misc state:
mHost=android.app.Activity$HostCallbacks@d9198fc
mContainer=android.app.Activity$HostCallbacks@d9198fc
mCurState=5 mStateSaved=false mDestroyed=false
ViewRoot:
mAdded=true mRemoved=false
mConsumeBatchedInputScheduled=false
mConsumeBatchedInputImmediatelyScheduled=false
mPendingInputEventCount=0
mProcessInputEventsScheduled=false
mTraversalScheduled=false mIsAmbientMode=false
android.view.ViewRootImpl$NativePreImeInputStage: mQueueLength=0
android.view.ViewRootImpl$ImeInputStage: mQueueLength=0
android.view.ViewRootImpl$NativePostImeInputStage: mQueueLength=0
Choreographer:
mFrameScheduled=false
mLastFrameTime=92939403 (26980 ms ago)
View Hierarchy:
DecorView@1211c2[SampleActivity]
android.widget.LinearLayout{2831b85 V.E...... ........ 0,0-1080,2076}
android.view.ViewStub{2136dda G.E...... ......I. 0,0-0,0 #102048c android:id/action_mode_bar_stub}
android.widget.FrameLayout{e5a620b V.E...... ........ 0,72-1080,2076 #1020002 android:id/content}
android.widget.RelativeLayout{5dd48e8 V.E...... ........ 0,0-1080,2004}
android.widget.RelativeLayout{6deeb01 V.E...... ........ 30,30-1050,180}
android.widget.ImageView{c4a8da6 V.ED..... ........ 0,0-150,150}
android.widget.TextView{74b13e7 V.ED..... ........ 344,14-675,135}
android.widget.Button{6b20b94 VFED..C.. ........ 390,927-690,1077 #7f0d0096 app:id/contacts_permission_button}
android.widget.TextView{1ce363d V.ED..... ........ 720,927-1020,1077 #7f0d0097 app:id/contacts_permission_feedback}
android.widget.Button{981de32 VFED..C.. ........ 390,717-690,867 #7f0d0098 app:id/camera_permission_button}
android.widget.TextView{aab0783 V.ED..... ........ 720,717-1020,867 #7f0d0099 app:id/camera_permission_feedback}
android.widget.Button{96e4d00 VFED..C.. ........ 390,1137-690,1287 #7f0d009a app:id/audio_permission_button}
android.widget.TextView{d6cf939 V.ED..... ........ 720,1137-1020,1287 #7f0d009b app:id/audio_permission_feedback}
android.widget.Button{66bab7e VFED..C.. ........ 60,927-360,1077 #7f0d009c app:id/all_permissions_button}
android.view.View{b8c98df V.ED..... ........ 0,2076-1080,2220 #1020030 android:id/navigationBarBackground}
android.view.View{ceb392c V.ED..... ........ 0,0-1080,72 #102002f android:id/statusBarBackground}
Looper (main, tid 1) {f9aeff5}
(Total messages: 0, polling=false, quitting=false)
displayId=0
I think this solves the duplicate entry in overview where the DexterActivity was in its own task. I am concerned about the case where we have multiple DexterActivities opened in different tasks through implicit intents or deep links (think Barcode scanning or camera app). I do not think that this needs to be handled in this PR, but allowing multiple DexterActivities introduces the possibility that pending permissions requests within a backgrounded task stack get orphaned.
This PR applies the suggested changes in #143
@nex0s, @ultraon, @EmmettWilson can you see if this change addresses the issue you were having?
The rationale behind the original setup was to stop worrying about creating more than one inner activity (or ghost activity) which is what Dexter uses behind the scenes to ask for permissions. I've been doing some testing myself and looks like there is no way of creating multiple inner activities anymore (I've been rotating the device in every single step, pressed the back button and so), what's more, if a new activity is created then Dexter will replace its reference to point the new one and the old one should be flagged to be removed.
Let me know if you can find any problem with this solution.