Browse Source

[Android] Use target API 23

master
Lyubo Marinov 8 years ago
parent
commit
e54744e5ef

+ 1
- 1
android/sdk/build.gradle View File

106
                 '--reset-cache')
106
                 '--reset-cache')
107
 
107
 
108
             // Disable bundling on dev builds
108
             // Disable bundling on dev builds
109
-            //enabled !devEnabled
109
+            enabled !devEnabled
110
         }
110
         }
111
 
111
 
112
         // Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process
112
         // Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process

+ 36
- 30
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java View File

39
  */
39
  */
40
 public class JitsiMeetActivity extends AppCompatActivity {
40
 public class JitsiMeetActivity extends AppCompatActivity {
41
     /**
41
     /**
42
-     * Code for identifying the permission to draw on top of other apps. The
43
-     * number is chosen arbitrarily and used to correlate the intent with its
44
-     * result.
42
+     * The request code identifying requests for the permission to draw on top
43
+     * of other apps. The value must be 16-bit and is arbitrarily chosen here. 
45
      */
44
      */
46
-    public static final int OVERLAY_PERMISSION_REQ_CODE = 4242;
45
+    private static final int OVERLAY_PERMISSION_REQUEST_CODE
46
+        = (int) (Math.random() * Short.MAX_VALUE);
47
 
47
 
48
     /**
48
     /**
49
      * Instance of the {@link JitsiMeetView} which this activity will display.
49
      * Instance of the {@link JitsiMeetView} which this activity will display.
56
      */
56
      */
57
     private boolean welcomePageEnabled;
57
     private boolean welcomePageEnabled;
58
 
58
 
59
+    private boolean canRequestOverlayPermission() {
60
+        return
61
+            BuildConfig.DEBUG
62
+                && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
63
+                && getApplicationInfo().targetSdkVersion
64
+                    >= Build.VERSION_CODES.M;
65
+    }
66
+
59
     /**
67
     /**
60
      *
68
      *
61
      * @see JitsiMeetView#getWelcomePageEnabled
69
      * @see JitsiMeetView#getWelcomePageEnabled
64
         return view == null ? welcomePageEnabled : view.getWelcomePageEnabled();
72
         return view == null ? welcomePageEnabled : view.getWelcomePageEnabled();
65
     }
73
     }
66
 
74
 
75
+    /**
76
+     * Initializes the {@link #view} of this {@code JitsiMeetActivity} with a
77
+     * new {@link JitsiMeetView} instance.
78
+     */
79
+    private void initializeView() {
80
+        view = new JitsiMeetView(this);
81
+
82
+        // In order to have the desired effect
83
+        // JitsiMeetView#setWelcomePageEnabled(boolean) must be invoked before
84
+        // JitsiMeetView#loadURL(URL).
85
+        view.setWelcomePageEnabled(welcomePageEnabled);
86
+        view.loadURL(null);
87
+
88
+        setContentView(view);
89
+    }
90
+
67
     /**
91
     /**
68
      * Loads the given URL and displays the conference. If the specified URL is
92
      * Loads the given URL and displays the conference. If the specified URL is
69
      * null, the welcome page is displayed instead.
93
      * null, the welcome page is displayed instead.
82
             int requestCode,
106
             int requestCode,
83
             int resultCode,
107
             int resultCode,
84
             Intent data) {
108
             Intent data) {
85
-        if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
86
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
87
-                if (!Settings.canDrawOverlays(this)) {
88
-                    // Permission not granted.
89
-                    return;
90
-                }
109
+        if (requestCode == OVERLAY_PERMISSION_REQUEST_CODE
110
+                && canRequestOverlayPermission()) {
111
+            if (Settings.canDrawOverlays(this)) {
112
+                initializeView();
91
             }
113
             }
92
-
93
-            setupView();
94
         }
114
         }
95
     }
115
     }
96
 
116
 
112
     protected void onCreate(Bundle savedInstanceState) {
132
     protected void onCreate(Bundle savedInstanceState) {
113
         super.onCreate(savedInstanceState);
133
         super.onCreate(savedInstanceState);
114
 
134
 
115
-        // In debug mode React needs permission to write over other apps in
135
+        // In Debug builds React needs permission to write over other apps in
116
         // order to display the warning and error overlays.
136
         // order to display the warning and error overlays.
117
-        if (BuildConfig.DEBUG
118
-                && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
119
-                && !Settings.canDrawOverlays(this)) {
137
+        if (canRequestOverlayPermission() && !Settings.canDrawOverlays(this)) {
120
             Intent intent
138
             Intent intent
121
                 = new Intent(
139
                 = new Intent(
122
                         Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
140
                         Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
123
                         Uri.parse("package:" + getPackageName()));
141
                         Uri.parse("package:" + getPackageName()));
124
 
142
 
125
-            startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);
143
+            startActivityForResult(intent, OVERLAY_PERMISSION_REQUEST_CODE);
126
             return;
144
             return;
127
         }
145
         }
128
 
146
 
129
-        setupView();
147
+        initializeView();
130
     }
148
     }
131
 
149
 
132
     /**
150
     /**
167
         JitsiMeetView.onHostResume(this);
185
         JitsiMeetView.onHostResume(this);
168
     }
186
     }
169
 
187
 
170
-    private void setupView() {
171
-        view = new JitsiMeetView(this);
172
-
173
-        // In order to have the desired effect
174
-        // JitsiMeetView#setWelcomePageEnabled(boolean) must be invoked before
175
-        // JitsiMeetView#loadURL(URL).
176
-        view.setWelcomePageEnabled(welcomePageEnabled);
177
-        view.loadURL(null);
178
-
179
-        setContentView(view);
180
-    }
181
-
182
     /**
188
     /**
183
      *
189
      *
184
      * @see JitsiMeetView#setWelcomePageEnabled
190
      * @see JitsiMeetView#setWelcomePageEnabled

+ 2
- 2
react/features/base/media/reducer.js View File

63
  * @type {VideoMediaState}
63
  * @type {VideoMediaState}
64
  */
64
  */
65
 const VIDEO_INITIAL_MEDIA_STATE = {
65
 const VIDEO_INITIAL_MEDIA_STATE = {
66
+    available: true,
66
     facingMode: CAMERA_FACING_MODE.USER,
67
     facingMode: CAMERA_FACING_MODE.USER,
67
-    muted: true,
68
-    available: true
68
+    muted: false
69
 };
69
 };
70
 
70
 
71
 /**
71
 /**

Loading…
Cancel
Save