Hash :
e19377af
        
        Author :
  
        
        Date :
2024-08-21T14:52:09
        
      
Tests: Support multiple users on Android
On most Android platforms, the userId is '0' and many of our defaults
just work. But on some, the default is non-zero, and that complicates
things.
To support this, we have to specify which user is correct, which can
be determined with:
    adb shell am get-current-user
Update everywhere we were using sdcard directly and use:
    Before: /sdcard
    After:  /storage/emulated/<userId>
Incorporate the userId to find the application's home directory:
    Before: /data/data/com.android.angle.test
    After:  /data/user/<userId>/com.android.angle.test
This CL:
- Starts using a user flag in our Android scripts
- Updates where tests look for test data and binaries
- Updates where scripts use temp and external storage
- Updates script to not use sdcard at all when root
- Disables run-as when user is not default
Bug: b/361388557
Change-Id: I0fb556ecb2d0f6bc6569a858c290b127217d4638
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5825122
Commit-Queue: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Roman Lavrov <romanl@google.com>
      
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// AndroidWindow.h: Definition of the implementation of OSWindow for Android
#ifndef UTIL_ANDROID_WINDOW_H_
#define UTIL_ANDROID_WINDOW_H_
#include "util/OSWindow.h"
class AndroidWindow : public OSWindow
{
  public:
    AndroidWindow();
    ~AndroidWindow() override;
    void disableErrorMessageDialog() override;
    void destroy() override;
    void resetNativeWindow() override;
    EGLNativeWindowType getNativeWindow() const override;
    EGLNativeDisplayType getNativeDisplay() const override;
    void messageLoop() override;
    void setMousePosition(int x, int y) override;
    bool setOrientation(int width, int height) override;
    bool setPosition(int x, int y) override;
    bool resize(int width, int height) override;
    void setVisible(bool isVisible) override;
    void signalTestEvent() override;
    ANGLE_UTIL_EXPORT static std::string GetExternalStorageDirectory();
    ANGLE_UTIL_EXPORT static std::string GetApplicationDirectory();
  private:
    bool initializeImpl(const std::string &name, int width, int height) override;
};
#endif /* UTIL_ANDROID_WINDOW_H_ */