Skip to content

Commit

Permalink
streamlined some code.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpkarras committed Sep 17, 2023
1 parent 6a8be27 commit 7fb0623
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
minSdk 30
targetSdk 31
versionCode 1
versionName "1.0.4.2-1"
versionName "1.0.4.2-2"
signingConfig signingConfigs.debug
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ public void onActivityResult(ActivityResult result) {
mediaProjection = mediaProjectionManager.getMediaProjection(result.getResultCode(), result.getData());
displayManager = (DisplayManager) getSystemService(DISPLAY_SERVICE);
Display[] displays = displayManager.getDisplays();
rearDisplayId.set(displays[1].getDisplayId());
for (Display display : displays) {
if(display.getName().equals("Built-in Screen") && display.getDisplayId() != 0) {
rearDisplayId.set(display.getDisplayId());
break;
}
}
rearDisplay = createDisplayContext(displayManager.getDisplay(rearDisplayId.get()));
activityOptions = activityOptions.makeBasic();
activityOptions.setLaunchDisplayId(rearDisplayId.get());
Expand Down
13 changes: 0 additions & 13 deletions app/src/main/java/com/tpkarras/mirror2rearultra/Mirror.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.os.RemoteException;
import android.os.SystemClock;
import android.provider.Settings;
import android.util.Log;
import android.view.IWindowManager;
import android.view.OrientationEventListener;
import android.view.Surface;
Expand Down Expand Up @@ -61,17 +60,9 @@ public static void rearScreenSwitch(boolean z){
parcel.writeInt(1);
parcel.writeString("CAMERA_CALL");
} else {
if(subscreenSwitch == 1) {
code = 16777211;
parcel.writeLong(SystemClock.uptimeMillis());
parcel.writeString("CAMERA_CALL");
} else {
code = 16777208;
if (sBinder != null) {
parcel.writeStrongBinder(sBinder);
}
parcel.writeInt(1);
}
}
try {
Method serviceMethod = Class.forName("android.os.ServiceManager").getMethod("getService", String.class);
Expand All @@ -93,8 +84,6 @@ protected void onCreate(Bundle savedInstanceState){
serviceMethod = Class.forName("android.os.ServiceManager").getMethod("getService", String.class);
windowBinder = (IBinder) serviceMethod.invoke(null, "window");
wm = IWindowManager.Stub.asInterface(windowBinder);
Log.d("wm", wm.toString());
Log.d("wm", String.valueOf(wm.getDefaultDisplayRotation()));
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
Expand All @@ -103,8 +92,6 @@ protected void onCreate(Bundle savedInstanceState){
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
orientationEventListener = new OrientationEventListener(getApplicationContext(), SensorManager.SENSOR_DELAY_NORMAL) {
@Override
Expand Down

0 comments on commit 7fb0623

Please sign in to comment.