Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Side by Side Diff: ui/android/java/src/org/chromium/ui/display/DisplayAndroidManager.java

Issue 2646573002: [M56 fork] Fix DeviceDisplayInfo UnsatisfiedLinkError (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.ui.display; 5 package org.chromium.ui.display;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.ComponentCallbacks; 8 import android.content.ComponentCallbacks;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.res.Configuration; 10 import android.content.res.Configuration;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // The DisplayManager API observers all display updates, so in theory it should not matter 207 // The DisplayManager API observers all display updates, so in theory it should not matter
208 // which context is used to obtain it. If this turns out not to be true in practice, it's 208 // which context is used to obtain it. If this turns out not to be true in practice, it's
209 // possible register from all context used though quite complex. 209 // possible register from all context used though quite complex.
210 return ContextUtils.getApplicationContext(); 210 return ContextUtils.getApplicationContext();
211 } 211 }
212 212
213 private static DisplayManager getDisplayManager() { 213 private static DisplayManager getDisplayManager() {
214 return (DisplayManager) getContext().getSystemService(Context.DISPLAY_SE RVICE); 214 return (DisplayManager) getContext().getSystemService(Context.DISPLAY_SE RVICE);
215 } 215 }
216 216
217 private static void updateDeviceDisplayInfo() { 217 private void updateDeviceDisplayInfo() {
218 if (mNativePointer == 0) return;
218 DeviceDisplayInfo.create(getContext()).updateNativeSharedDisplayInfo(); 219 DeviceDisplayInfo.create(getContext()).updateNativeSharedDisplayInfo();
219 } 220 }
220 221
221 @CalledByNative 222 @CalledByNative
222 private static void onNativeSideCreated(long nativePointer) { 223 private static void onNativeSideCreated(long nativePointer) {
223 DisplayAndroidManager singleton = getInstance(); 224 DisplayAndroidManager singleton = getInstance();
224 singleton.setNativePointer(nativePointer); 225 singleton.setNativePointer(nativePointer);
225 } 226 }
226 227
227 private DisplayAndroidManager() {} 228 private DisplayAndroidManager() {}
(...skipping 22 matching lines...) Expand all
250 mBackend.startListening(); 251 mBackend.startListening();
251 } 252 }
252 253
253 private void setNativePointer(long nativePointer) { 254 private void setNativePointer(long nativePointer) {
254 mNativePointer = nativePointer; 255 mNativePointer = nativePointer;
255 nativeSetPrimaryDisplayId(mNativePointer, mMainSdkDisplayId); 256 nativeSetPrimaryDisplayId(mNativePointer, mMainSdkDisplayId);
256 257
257 for (int i = 0; i < mIdMap.size(); ++i) { 258 for (int i = 0; i < mIdMap.size(); ++i) {
258 updateDisplayOnNativeSide(mIdMap.valueAt(i)); 259 updateDisplayOnNativeSide(mIdMap.valueAt(i));
259 } 260 }
261 updateDeviceDisplayInfo();
260 } 262 }
261 263
262 /* package */ DisplayAndroid getDisplayAndroid(Display display) { 264 /* package */ DisplayAndroid getDisplayAndroid(Display display) {
263 int sdkDisplayId = display.getDisplayId(); 265 int sdkDisplayId = display.getDisplayId();
264 DisplayAndroid displayAndroid = mIdMap.get(sdkDisplayId); 266 DisplayAndroid displayAndroid = mIdMap.get(sdkDisplayId);
265 if (displayAndroid == null) { 267 if (displayAndroid == null) {
266 displayAndroid = addDisplay(display); 268 displayAndroid = addDisplay(display);
267 } 269 }
268 return displayAndroid; 270 return displayAndroid;
269 } 271 }
(...skipping 24 matching lines...) Expand all
294 displayAndroid.getBitsPerPixel(), displayAndroid.getBitsPerCompo nent()); 296 displayAndroid.getBitsPerPixel(), displayAndroid.getBitsPerCompo nent());
295 } 297 }
296 298
297 private native void nativeUpdateDisplay(long nativeDisplayAndroidManager, in t sdkDisplayId, 299 private native void nativeUpdateDisplay(long nativeDisplayAndroidManager, in t sdkDisplayId,
298 int physicalWidth, int physicalHeight, int width, int height, float dipScale, 300 int physicalWidth, int physicalHeight, int width, int height, float dipScale,
299 int rotationDegrees, int bitsPerPixel, int bitsPerComponent); 301 int rotationDegrees, int bitsPerPixel, int bitsPerComponent);
300 private native void nativeRemoveDisplay(long nativeDisplayAndroidManager, in t sdkDisplayId); 302 private native void nativeRemoveDisplay(long nativeDisplayAndroidManager, in t sdkDisplayId);
301 private native void nativeSetPrimaryDisplayId( 303 private native void nativeSetPrimaryDisplayId(
302 long nativeDisplayAndroidManager, int sdkDisplayId); 304 long nativeDisplayAndroidManager, int sdkDisplayId);
303 } 305 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698