Profile Owner.. - Android Software/Hacking General [Developers Only]

Hello together
since more than 4 Days i stuck on my current app project with the message: "admin componentinfo does not own the profile".
I tried many things - Added an Work Profile programmaticaly - Gave Profile Owner via adb and i dont find the result.
Someone have an Idea, what im doing wrong?
Code to add managed profile:
Java:
private void provisionManagedProfile()
{
Activity activity = this;
if (null == activity) {
return;
}
Intent intent = new Intent(DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
intent.putExtra(
DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME,
activity.getApplicationContext().getPackageName()
);
} else {
final ComponentName component = new ComponentName(activity,
DeviceAdmin.class.getName());
intent.putExtra(
DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME,
component
);
}
if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivityForResult(intent, 1);
Toast.makeText(activity, "Already used!",
Toast.LENGTH_SHORT).show();
activity.finish();
} else {
Toast.makeText(activity, "Device provisioning is not enabled. Stopping.",
Toast.LENGTH_SHORT).show();
}
}
Code to use:
Java:
DevicePolicyManager dpm = (DevicePolicyManager) getApplicationContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
dpm.setProfileEnabled(compName);
compName is:
Java:
compName = new ComponentName(this, DeviceAdmin.class);
#Edit
If i start the manged Profile, its crashed after the end before the "next" button showing.
But if i take an look on my settings its showing that this profile was created.
Greetings

tpoeschl said:
Hello together
since more than 4 Days i stuck on my current app project with the message: "admin componentinfo does not own the profile".
I tried many things - Added an Work Profile programmaticaly - Gave Profile Owner via adb and i dont find the result.
Someone have an Idea, what im doing wrong?
Code to add managed profile:
Java:
private void provisionManagedProfile()
{
Activity activity = this;
if (null == activity) {
return;
}
Intent intent = new Intent(DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
intent.putExtra(
DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME,
activity.getApplicationContext().getPackageName()
);
} else {
final ComponentName component = new ComponentName(activity,
DeviceAdmin.class.getName());
intent.putExtra(
DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME,
component
);
}
if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivityForResult(intent, 1);
Toast.makeText(activity, "Already used!",
Toast.LENGTH_SHORT).show();
activity.finish();
} else {
Toast.makeText(activity, "Device provisioning is not enabled. Stopping.",
Toast.LENGTH_SHORT).show();
}
}
Code to use:
Java:
DevicePolicyManager dpm = (DevicePolicyManager) getApplicationContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
dpm.setProfileEnabled(compName);
compName is:
Java:
compName = new ComponentName(this, DeviceAdmin.class);
#Edit
If i start the manged Profile, its crashed after the end before the "next" button showing.
But if i take an look on my settings its showing that this profile was created.
Greetings
Click to expand...
Click to collapse
Technical discussion of Android development and hacking. No noobs, please. Device-specific releases should go under the appropriate device forum.
Note: Questions go in Q&A Forum
If you are posting a Question Thread post it in the Q&A forum. Technical discussion of Android development and hacking. No noobs, please. Device-specific releases should go under the appropriate device forum...
forum.xda-developers.com

Related

How to load native library in Android

Can someone give advice in how to load native library and make native function calls in android application? I tried with android 1.0 and my result is below:
Result:
1. I added the following code to android application Lunarlander.java
//native method declaration
native void hello(String name);
static {
System.out.println("libhello.so loaded");
System.load("/data/app/libhello.so");
}
I added my libhellp.so to lunalander.apk and then uploaded the apk to /data/app. The application launches ok.
2. I added the following code to android application Lunarlander.java
//native method declaration
native void hello(String name);
static {
System.out.println("libhello.so loaded");
System.load("/data/app/libhello.so");
}
…
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
…
//test loading hello lib and call hello function
LunarLander myLunarLander = new LunarLander();
myLunarLander.hello("Hi there!");
…
}
I added my libhellp.so to lunalander.apk and then uploaded the apk to /data/app. The application launches was forced to close and the error message is “The application Lunar lander has stopped unexpectedly. Please try again”.
Not sure why it failed to invoke the native function.
Thanks,
SynPad
Please post Questions in the Q&A section. Dev and Hacking Section is for contributers (new programs themes ect)
I'll go ahead and have the thread moved to Q&A for you this time
Thanks for your cooperation,
Joel
Q&A Section Team
EDIT: you may also want to try the g1 section, pm me if you would like it moved there instead.
Check the samples w/ NDK
BTW, do you know how to ship the lib along the apk :
there is a "native library location:" entry on project settings in eclipse plugin
Later

[Q] Is there any one to help me integration admob to my android project?

Hi guys !..
i got one problem kinda big cause i never find solition untill 1 month i hope i can get correct answer from here.( only admob prolem )
My problem is i cant add admob to my project allways i get error about "unfortunely has stopped" after splash secreen.
My codes are ..
main.xml :
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="ht t p:/ /schemas.android com/apk/res/android" //for link error by this website
xmlns:ads="h t tp:/ /schemas.android com/apk/lib/com.google.ads" //for link error by this website
android:id="@+id/layout"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_UNIT_ID"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR"
ads:loadAdOnCreate="true"/>
</RelativeLayout>
Main.java file
Code:
package com.example.proje;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
/**
Ozzy Ozmen Celik
*/
public class Anasayfa extends Activity {
private WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
// Webview
mWebView = (WebView) findViewById(R.id.WebView);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new wapWebViewClient());
mWebView.loadUrl("adress");
}
private class wapWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
// when the page loaded splash screen has been invisible
mWebView.setVisibility(View.VISIBLE);
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
// if any error occured this message will be showed
Toast.makeText(Anasayfa.this, "Pls try again later...." + description, Toast.LENGTH_LONG).show();
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
// setting of back button
mWebView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
Manifest.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="h tt p : / /schemas.android com/apk/res/android"
package="com.example.proje"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" >
</uses-permission>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Giris"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Anasayfa"
android:label="@string/app_name">
<intent-filter>
<action android:name="com .example.proje.Anasayfa" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
</manifest>
String.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Proje</string>
<string name="admob">admob</string>
<string name="reklam">reklam</string>
<string name="ad">ad</string>
<string name="adView">adView</string>
</resources>
google admob mobile ad java is "GoogleAdMobAdsSdk-6.4.1.jar"
Still waiting for help !...
Still waiting for help !...
Ozzy Ozmen said:
Hi guys !..
i got one problem kinda big cause i never find solition untill 1 month i hope i can get correct answer from here.( only admob prolem )
My problem is i cant add admob to my project allways i get error about "unfortunely has stopped" after splash secreen.
Click to expand...
Click to collapse
Im not an experienced developer but , i would like to know ...what exception did u get for this error.
droidshan said:
Im not an experienced developer but , i would like to know ...what exception did u get for this error.
Click to expand...
Click to collapse
i just tryed to import java codes and after it giveen me an error and still doesnt work.Actually i got problem with java code could u fix up ma java codes for solve pls if u dont mind cause i need soo much .i ve been searhing on net wihe ago and still couldnt find the correct codes....
totally ive got main.java error ..... i think i can import my codes right
Ozzy Ozmen said:
i just tryed to import java codes and after it giveen me an error and still doesnt work.Actually i got problem with java code could u fix up ma java codes for solve pls if u dont mind cause i need soo much .i ve been searhing on net wihe ago and still couldnt find the correct codes....
totally ive got main.java error ..... i think i can import my codes right
Click to expand...
Click to collapse
Observe Logcat output
or just do:
try{
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.newlayout);
// Webview
mWebView = (WebView) findViewById(R.id.webView);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new wapWebViewClient());
mWebView.loadUrl("adress");
}
catch(Exception e){
Toast.makeText(MainActivity.this, "Exception" + e, Toast.LENGTH_LONG).show();
}
check for: what error is being displayed
droidshan said:
Observe Logcat output
or just do:
try{
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.newlayout);
// Webview
mWebView = (WebView) findViewById(R.id.webView);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new wapWebViewClient());
mWebView.loadUrl("adress");
}
catch(Exception e){
Toast.makeText(MainActivity.this, "Exception" + e, Toast.LENGTH_LONG).show();
}
check for: what error is being displayed
Click to expand...
Click to collapse
Thnks for asist actually my project and webview is working correct but when i import admob it gives me error i thought might be give me main.java codes work with admob java code included
Please don't post here unless you intend to help with the problem in the OP.
Also, this thread can only be bumped every 24hrs. according to the rules of this site. Please see below:
Forum Rule 16. Bumping Threads (posting simply to force a thread to the top of the thread queue)
Do not "bump" a thread more than once per 24 hours.
Click to expand...
Click to collapse

[Completed] [Q] how to Provide intent for cards

How to give intent for accessing card activity,its not taking usual class.
Below is code snippet im providing. can anyone provide me solution
public void onClick(View v) {
if(txtUsername.getText().toString().equals("test") &&
txtPassword.getText().toString().equals("1234")){
Toast.makeText(getApplicationContext(), "Credentials Accepted",
Toast.LENGTH_SHORT).show();
Intent i = new Intent(Login_activity.this, HelloCardActivity.class); //hellocardactivity is another card activity. and login_activity is login page
startActivity(i);
Login_activity.this.finish();
}
else{
Toast.makeText(getApplicationContext(), "Wrong Credentials",
Toast.LENGTH_SHORT).show();
}
}
pls provide a solution
thank you
abhishek1234567 said:
How to give intent for accessing card activity,its not taking usual class.
Below is code snippet im providing. can anyone provide me solution
public void onClick(View v) {
if(txtUsername.getText().toString().equals("test") &&
txtPassword.getText().toString().equals("1234")){
Toast.makeText(getApplicationContext(), "Credentials Accepted",
Toast.LENGTH_SHORT).show();
Intent i = new Intent(Login_activity.this, HelloCardActivity.class); //hellocardactivity is another card activity. and login_activity is login page
startActivity(i);
Login_activity.this.finish();
}
else{
Toast.makeText(getApplicationContext(), "Wrong Credentials",
Toast.LENGTH_SHORT).show();
}
}
pls provide a solution
thank you
Click to expand...
Click to collapse
Please ask in the Chef Central > Android forum.
Just keep in mind that you have to provide more information (abot what card, on which device for what purpose, etc.) to get a more detailed help
Thread closed and thank you.

[Completed] AT&T Galaxy Alpha g850A US Variant Possible Root Exploit Found

Hi Mods,
I do not have permissions to post in the development forum so I ask that you move this thread accordingly.
I have been researching the AT&T Galaxy Alpha sm-g850a variant in order to gain root access and, as you might know, have found absolutely nothing out there. All other international variants have been rooted Except the A model...which is what I am stuck with. I found a recently released CVE that states it is not patched until Lollipop 5.0 and allows a malicious intent request to take over SYSTEM permissions. I have been able to get the intent code into an app without bricking the phone and am having some NOOB java issues as I'm not a professional programmer. Any interest in helping finish this exploit would be greatly appreciated. A few code snippets below:
import android.accounts.NetworkErrorException;
import android.app.PendingIntent;
import android.accounts.AbstractAccountAuthenticator;
import android.accounts.Account;
import android.accounts.AccountAuthenticatorResponse;
import android.accounts.AccountManager;
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
android.content.Intent intent = new Intent();
intent.setComponent(new ComponentName("com.android.settings","com.android.settings.accounts.AddAccountSettings"));
AccountManager.get(this).addAccount(
accountType,
null, /* authTokenType */
null, /* requiredFeatures */
addAccountOptions,
null,
mCallback,
null /* handler */);
mAddAccountCalled = true;
PendingIntent test = (PendingIntent) options.getParcelable("pendingIntent");
Intent newIntent2 = new Intent("android.intent.action.REBOOT"); <---testing---> somewhere in here I need to drop the SU binary and all of that good stuff.
try {
test.send(mContext, 0, newIntent2, null, null);
} catch (PendingIntent.CanceledException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
There is more code obviously. Posting some main parts to see if anyone is interested in helping.
w/respect-PitPin
Can't forget the credit for discovering this vulnerability:
Credits: Wang,Tao(Scloud) - seclist.org
Here is my NOOB showing. Wouldn't this mean I am on the right track and my app took "system root" privileges?
7386-7386/com.pitpindesigns.modpit.pitpin E/dalvikvm﹕ >>>>> com.pitpindesigns.modpit.pitpin [ userId:0 | appId:10248 ]
Nope...1000 would be root.
Sir,
Here isn't the right place for this type of threads so please open a new one here:
xda-developers -> Android Development and Hacking -> Android General
Good luck

[Completed] zte cm13 compile error

Install: /home/skipkou/android/cm/out/host/linux-x86/bin/checkpolicy
/home/skipkou/android/cm/out/host/linux-x86/bin/checkpolicy: loading policy configuration from /home/skipkou/android/cm/out/target/product/msm8974/obj/ETC/sepolicy_intermediates/policy.conf
libsepol.report_failure: neverallow on line 462 of external/sepolicy/domain.te (or line 5718 of policy.conf) violated by allow netd shellrocess { transition };
libsepol.report_failure: neverallow on line 441 of external/sepolicy/domain.te (or line 5699 of policy.conf) violated by allow mm-qcamerad system_data_file:file { write create };
libsepol.report_failure: neverallow on line 280 of external/sepolicy/domain.te (or line 5546 of policy.conf) violated by allow mm-qcamerad device:chr_file { read write open };
libsepol.report_failure: neverallow on line 254 of external/sepolicy/domain.te (or line 5520 of policy.conf) violated by allow shell system_file:file { entrypoint };
libsepol.check_assertions: 4 neverallow failures occurred
Error while expanding policy
make: *** [/home/skipkou/android/cm/out/target/product/msm8974/obj/ETC/sepolicy_intermediates/sepolicy] error 1
(⊙o⊙)
skipkou said:
Install: /home/skipkou/android/cm/out/host/linux-x86/bin/checkpolicy
/home/skipkou/android/cm/out/host/linux-x86/bin/checkpolicy: loading policy configuration from /home/skipkou/android/cm/out/target/product/msm8974/obj/ETC/sepolicy_intermediates/policy.conf
libsepol.report_failure: neverallow on line 462 of external/sepolicy/domain.te (or line 5718 of policy.conf) violated by allow netd shellrocess { transition };
libsepol.report_failure: neverallow on line 441 of external/sepolicy/domain.te (or line 5699 of policy.conf) violated by allow mm-qcamerad system_data_file:file { write create };
libsepol.report_failure: neverallow on line 280 of external/sepolicy/domain.te (or line 5546 of policy.conf) violated by allow mm-qcamerad device:chr_file { read write open };
libsepol.report_failure: neverallow on line 254 of external/sepolicy/domain.te (or line 5520 of policy.conf) violated by allow shell system_file:file { entrypoint };
libsepol.check_assertions: 4 neverallow failures occurred
Error while expanding policy
make: *** [/home/skipkou/android/cm/out/target/product/msm8974/obj/ETC/sepolicy_intermediates/sepolicy] error 1
(⊙o⊙)
Click to expand...
Click to collapse
Hello,
Thanks for using XDA Assist.
You can post your query in [GUIDE][COMPLETE] Android ROM Development From Source To End.Experts there may be able to help you
___
v7
XDA Assist
v7 said:
Hello,
Thanks for using XDA Assist.
You can post your query in [GUIDE][COMPLETE] Android ROM Development From Source To End.Experts there may be able to help you
___
v7
XDA Assist
Click to expand...
Click to collapse
OK,thank u

Categories

Resources