Do not load/release back gesture ML model after every device fold/unfold.

Previously, the model's state was being updated every time mIsEnabled changed, causing either a resource load or resource release depending on the direction of the change. However, mIsEnabled changes every time EdgeBackGestureHandler attaches or detaches, which happens every time a foldable folds or unfolds. Releasing and reloading the model's resources every fold/unfold is needless and wasteful.

Now, the model resources only load when the process starts or when the user enables Gesture Navigation mode. The model resources only get released when the user disabled Gesture Navigation mode.

This change is safe because no new behavior is added.

There is also an additional safety check added: now, if the model is currently loading, it will not be asked to predict.

Fix: 214938229
Test: manual

Change-Id: I6127b4a5acfa57e9faa0966d021bd951cf2d7bee
1 file changed