How to unlock iOS screen programmatically? - jailbreak

I'm currently exploring creating a jailbreak tweak. I want to unlock the phone screen. How is this done? What private API can be used to achieve this on iOS 7?

If we are talking about jailbreak then you can write a SpringBoard tweak that does this (iOS 7 only)
[[objc_getClass("SBBacklightController") sharedInstance] turnOnScreenFullyWithBacklightSource:0];
[[objc_getClass("SBLockScreenManager") sharedInstance] unlockUIFromSource:0 withOptions:nil];
Without passcode lock the code will turn on the screen and unlock the device. With passcode it will turn on the screen and request passcode.

I use Activator from Cydia to wake and unlock the device via SSH. It works on IOS 10.1.
activator send libactivator.system.homebutton
activator send libactivator.system.homebutton
lock command is here:
activator send libactivator.system.sleepbutton
Good Luck Have Fun :)

My solution comes in two parts but it could be better:
Power on screen by simulating a power button press with this code:
VNCSendHIDEvent(IOHIDEventCreateKeyboardEvent(kCFAllocatorDefault, mach_absolute_time(),
kHIDPage_Consumer, kHIDUsage_Csmr_Power, 1, 0)); // Power button down
VNCSendHIDEvent(IOHIDEventCreateKeyboardEvent(kCFAllocatorDefault, mach_absolute_time(),
kHIDPage_Consumer, kHIDUsage_Csmr_Power, 0, 0)); // Power button up
After 1, the screen will light up and then you can use SimulateTouch's stouch tool to simulate a swipe from the command line.
For 1 above, your code needs to have the com.apple.private.hid.client.event-dispatch entitlement.
For more, you can also investigate how Activator performs the Unlock screen listener.

Maybe not a direct solution.
You can use this tweak and library https://github.com/iolate/SimulateTouch to simulate a user swipe on the lockscreen to unlock the device.

Related

Telegram Web Apps method Expand isn't working

I found that the method Expand of window.Telegram.WebApp object isn't working in the Telegram client for Windows and IOS on computers and tablets.
How to increase the size of Web Apps frame for those devices?
function buttonOn(){
// do something on btn click
}
let main_page = document.querySelector('#main_page');
if (main_page){
window.Telegram.WebApp.expand() //expand window after page loading
window.Telegram.WebApp.MainButton.onClick(buttonOn) //set func on main button click
window.Telegram.WebApp.MainButton.setParams({'text': 'Корзина'}) // set byn params
window.Telegram.WebApp.MainButton.show() //show telegram btn
}
Other button events
Remove the line from the function:
window.Telegram.WebApp.expand() //expand window after page loading
And call it in the beginning/at the top of your main javascript code. (The code that will start running once the user has clicked on the button)
Also, you can make your code a lot shorter by putting window.Telegram.WebApp in a variable like:
const tele = window.Telegram.WebApp; //Initializes the TELEGRAM BOT and
//Gets the user's Telegram ID from the Telegram API
tele.expand(); //Expands the app on the users' phone to 100% height
The reason is, probably, you are a bit incorrect in understanding what "expansion" is. This term could only be applied to mobile devices with OS such as Android or iOS. Web App is displayed there in such native component as BottomSheet with inserted WebView containing your web application. Initially, in mobile devices, application is being opened minimized (not expanded). To make it use maximum allowed height of screen, you could call expand() method. It must work through window.Telegram.WebApp.expand().
In desktop or web versions of Telegram, Web App is displayed in separate component which is not allowed to change its size.
You could probably find more useful information about viewport and expansion here, or use alternative libraries, such as twa-bridge or twa-sdk

Azure AD (ADAL) Login Screen Loses Entered User Email on Device Orientation in Android Only-XamarinForms.Android

I have Xamarin.Forms application that authenticates user against Azure AAD using ADAL (Microsoft.IdentityModel.Clients.ActiveDirectory). That all works fine but on Android, device orientation looses user email on the Microsoft authentication screen.
Here I am in Portrait mode and I have entered user email:
Clicking on Next lands on screen asking to enter password. If I now rotate device on Android, it will return me back to blank screen above, user email I entered above is lost:
Device rotation should not return user back and re-prompt for user email again. It should stay on password prompt.
How do I prevent the rotation from re-prompting for user email? I dont want to disable rotation, I just want to prevent it from returning me back to screen that prompts for user email again.
This is Xamarin.Forms application and my MainActivity has already ConfigChages.Orientation attribute like below; however, this is not solving the issue:
[Activity(Name = "my.mainactivity"
, Label = "MyApp"
, Icon = "#drawable/icon"
, ConfigurationChanges = ConfigChanges.ScreenSize
| ConfigChanges.SmallestScreenSize
| ConfigChanges.ScreenLayout
| ConfigChanges.Orientation)]
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
...
}
UPDATE
Even if I freeze orientation to Portrait before call to AcquireTokenAsync and unfreeze it after the call receives response, it still behaves same - it will still rotate the Microsoft sign in page even though I freeze its parent (MainActivity) to Portrait (which is the owner passed in PlatformParameters to the call to AcquireTokenAsync. So, my activity stays in portrait but that sign-in page still rotates and looses data. It appears that the WebView Microsoft uses internally in AcquireTokenAsync is not following orientation settings on the activity passed inside PlatformParameters to AcquireTokenAsync.
Confirmed by Microsoft that this is their internal issues. If you are also running into this issue on Android where device rotation returns you back to prompt for user email, you can follow up progress of fixes for both ADAL and MSAL here:
https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/1622 https://github.com/xamarin/xamarin-android/issues/3326
I use Entry at my side, adding ConfigurationChanges = ConfigChanges.ScreenSize| ConfigChanges.Orientation, it works fine.
If you still have this issue, I suggest you can follow the next steps:
1.on Forms PCL, you can override OnSizeAllocated to check screen orientation, like this:
How to detect screen orientation of the device in Xamarin.Forms?
2.On Forms PCL and Android, you can use MessageCener to subscribe and send data
3.override method onSaveInstanceState() and onRestoreInstanceState(), like this:
Handle screen rotation without losing data - Android
The issue has been fixed in ADAL Release 5.1.1, and will be included in the next version of MSAL (most likely 4.3.1).
This issue is caused by Microsoft's ADAL component Microsoft.IdentityModel.Clients.ActiveDirectory and it has been fixed in 5.1.0 version released just couple of weeks ago (current version is 5.2.0).
What I had to do in order to fix this issue is:
1. Update ADAL from 3.19.8 to 5.2.0 (everything below 5.1.0 has this problem)
2. Then modified AuthorityURL passed to AuthenticationContext c-tor from something like https://login.microsoftonline.com/my-tenant-id/oauth2/authorize to https://login.microsoftonline.com/my-tenant-id
Number 2 was necessary even though Microsoft claims in most places that the change is non-breaking change (they confirmed this is necessary).
After this, I was able to authenticate just like before but rotation on Android would not loose already provided user id and/or password.

Disable default Android TV navigation sound effect Programmatically

How to disable sound feedback effect in Android TV Programmatically. If i press navigation button while music service is playing, sound effect mutes music for second. Or may be there is some priorities for music service? Thanks in advance
You can change it via the AudioManager like this:
AudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
audioManager.adjustStreamVolume(AudioManager.STREAM_NOTIFICATION, AudioManager.ADJUST_LOWER, 0 /*or: AudioManager.FLAG_SHOW_UI*/);
To get the current notification volume, use
audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION)
Possible volume values are 0..7.
From API level 23, you can also use AudioManager.ADJUST_MUTE.

onGoing notification can still be removed by user, manually

i create an application and i want after click on specific button, a "Permanent Nofitication" show on notification bar.
i search for it and use these codes:
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_clip_board_service)
.setContentTitle(getResources().getString(R.string.notifTitle))
.setContentText(getResources().getString(R.string.notifText))
.setOngoing(true);
the ongoing method, prevent user to manually clear the notification.in my emulator(genymotion), everything is ok.but in my real Phone(Huawei G8) when i try to remove notificaiton, a pop-up menu appeared and say:
Not Recomended
removing ongoing notification may affect app stability.
the menu has already two buttons:cancel and Remove.and i can remove the notification.:(
i don't want user manually remove notification.
is the problem about my Phone or setOngoing(true) method?
thanks in advance...
Based off what I'm seeing for my app that behaves similarly, it appear Huawei phone's always allow clearing notifications and shutting down the app. My app even runs as a device administrator and it can still be cleared.

Handle orientation's change when device's auto rotate's feature is disabled in Flex 4.6

"StageOrientationEvent.ORIENTATION_CHANGE" event does not fire (dispatch) when the Auto Rotate feature of the device is disabled.
I'm developing a game that only must work on PORTRAIT mode. I speculate many users unchecked this option display settings.
How can I detect screen rotation regardless of device setting. Should I use accelerometer for this purpose or there is a better way?
If your game must always work in PORTRAIT mode; then you don't have to worry about device orientation changes. What you want to do is make sure your game always launches in portrait mode despite what the device settings are.
In the Application Descriptor file; set these values:
<aspectRatio>portrait</aspectRatio>
<autoOrients>false</autoOrients>
The application descriptor file is the "MainApplication-app.xml' file that Flash Builder will create as you create your main application.
In documentation theory those changes should do it; but if memory serves me I had problems in some versions of Android, where the app launched in the wrong orientation and would not change.
So, inside my application I added applicationComplete and activate handlers on my main application file and used those methods to specify the aspect ratio of the game. Something like this:
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
applicationComplete="viewnavigatorapplication1_applicationCompleteHandler(event)"
activate="viewnavigatorapplication1_activateHandler(event)">
<fx:Script><![CDATA[
import mx.events.FlexEvent;
protected function viewnavigatorapplication1_applicationCompleteHandler(event:FlexEvent):void{
this.stage.setAspectRatio( StageAspectRatio.PORTRAIT);
}
protected function viewnavigatorapplication1_activateHandler(event:Event):void{
if(this.stage){
this.stage.setAspectRatio( StageAspectRatio.PORTRAIT );
}
}
]]></fx:Script>
</s:ViewNavigatorApplication>
I have no memory of testing this specific use case on iOS Devices; so it is possible I only had the problem on Android. Or it is possible I did the Android code first and that is why I never had a problem on iOS.
Although I have used this method, I cannot take credit for it but please see: Please see this thread
Remember if you are developing for iOS, you CANNOT LOCK Device Orientation. You HAVE to add event listeners to handle orientation changes for iOS. The very first app I did got rejected for trying to lock orientation.

Resources