コード例 #1
0
        private PackageInfo(android.os.Parcel source)
        {
            packageName     = source.readString();
            versionCode     = source.readInt();
            versionName     = source.readString();
            sharedUserId    = source.readString();
            sharedUserLabel = source.readInt();
            int hasApp = source.readInt();

            if (hasApp != 0)
            {
                applicationInfo = android.content.pm.ApplicationInfo.CREATOR.createFromParcel(source
                                                                                              );
            }
            firstInstallTime = source.readLong();
            lastUpdateTime   = source.readLong();
            gids             = source.createIntArray();
            activities       = source.createTypedArray(android.content.pm.ActivityInfo.CREATOR);
            receivers        = source.createTypedArray(android.content.pm.ActivityInfo.CREATOR);
            services         = source.createTypedArray(android.content.pm.ServiceInfo.CREATOR);
            providers        = source.createTypedArray(android.content.pm.ProviderInfo.CREATOR);
            instrumentation  = source.createTypedArray(android.content.pm.InstrumentationInfo.
                                                       CREATOR);
            permissions          = source.createTypedArray(android.content.pm.PermissionInfo.CREATOR);
            requestedPermissions = source.createStringArray();
            signatures           = source.createTypedArray(android.content.pm.Signature.CREATOR);
            configPreferences    = source.createTypedArray(android.content.pm.ConfigurationInfo.
                                                           CREATOR);
            reqFeatures     = source.createTypedArray(android.content.pm.FeatureInfo.CREATOR);
            installLocation = source.readInt();
        }
コード例 #2
0
        /// <summary>
        /// @brief Read application name (label) from package manager
        /// </summary>
        /// <param name="packageName">   application package
        /// </param>
        /// <returns> Application name retrieved from PackageManager </returns>
        public virtual string getApplicationName(string packageName)
        {
            string  appName = "<None>";
            Context context = Context;

            if (null == context)
            {
                Log.w(TAG, "Cannot retrieve application name: context is null");
                return(appName);
            }

            PackageManager  pm      = context.PackageManager;
            ApplicationInfo appInfo = null;

            try
            {
                appInfo = pm.getApplicationInfo(packageName, NO_FLAGS);
            }
            catch (PackageManager.NameNotFoundException)
            {
                Log.w(TAG, "Cannot retrieve application info for package: " + packageName);
            }

            if (null != appInfo)
            {
                appName = pm.getApplicationLabel(appInfo).ToString();
            }
            return(appName);
        }
コード例 #3
0
ファイル: ComponentInfo.cs プロジェクト: zhouweiaccp/XobotOS
 public override java.lang.CharSequence loadLabel(android.content.pm.PackageManager
                                                  pm)
 {
     if (nonLocalizedLabel != null)
     {
         return(nonLocalizedLabel);
     }
     android.content.pm.ApplicationInfo ai = applicationInfo;
     java.lang.CharSequence             label;
     if (labelRes != 0)
     {
         label = pm.getText(packageName, labelRes, ai);
         if (label != null)
         {
             return(label);
         }
     }
     if (ai.nonLocalizedLabel != null)
     {
         return(ai.nonLocalizedLabel);
     }
     if (ai.labelRes != 0)
     {
         label = pm.getText(packageName, ai.labelRes, ai);
         if (label != null)
         {
             return(label);
         }
     }
     return(java.lang.CharSequenceProxy.Wrap(name));
 }
コード例 #4
0
 public ApplicationInfo(android.content.pm.ApplicationInfo orig) : base(orig)
 {
     taskAffinity            = orig.taskAffinity;
     permission              = orig.permission;
     processName             = orig.processName;
     className               = orig.className;
     theme                   = orig.theme;
     flags                   = orig.flags;
     requiresSmallestWidthDp = orig.requiresSmallestWidthDp;
     compatibleWidthLimitDp  = orig.compatibleWidthLimitDp;
     largestWidthLimitDp     = orig.largestWidthLimitDp;
     sourceDir               = orig.sourceDir;
     publicSourceDir         = orig.publicSourceDir;
     nativeLibraryDir        = orig.nativeLibraryDir;
     resourceDirs            = orig.resourceDirs;
     sharedLibraryFiles      = orig.sharedLibraryFiles;
     dataDir                 = orig.dataDir;
     uid = orig.uid;
     targetSdkVersion        = orig.targetSdkVersion;
     enabled                 = orig.enabled;
     enabledSetting          = orig.enabledSetting;
     installLocation         = orig.installLocation;
     manageSpaceActivityName = orig.manageSpaceActivityName;
     descriptionRes          = orig.descriptionRes;
     uiOptions               = orig.uiOptions;
 }
コード例 #5
0
 public abstract void bindApplication(string arg1, android.content.pm.ApplicationInfo
                                      arg2, java.util.List <android.content.pm.ProviderInfo> arg3, android.content.ComponentName
                                      arg4, string arg5, android.os.ParcelFileDescriptor arg6, bool arg7, android.os.Bundle
                                      arg8, android.app.IInstrumentationWatcher arg9, int arg10, bool arg11, bool arg12
                                      , android.content.res.Configuration arg13, android.content.res.CompatibilityInfo
                                      arg14, java.util.Map <string, android.os.IBinder> arg15, android.os.Bundle arg16
                                      );
コード例 #6
0
ファイル: LoadedApk.cs プロジェクト: zhouweiaccp/XobotOS
 /// <summary>
 /// Create information about a new .apk
 /// NOTE: This constructor is called with ActivityThread's lock held,
 /// so MUST NOT call back out to the activity manager.
 /// </summary>
 /// <remarks>
 /// Create information about a new .apk
 /// NOTE: This constructor is called with ActivityThread's lock held,
 /// so MUST NOT call back out to the activity manager.
 /// </remarks>
 public LoadedApk(android.app.ActivityThread activityThread, android.content.pm.ApplicationInfo
                  aInfo, android.content.res.CompatibilityInfo compatInfo, android.app.ActivityThread
                  mainThread, java.lang.ClassLoader baseLoader, bool securityViolation, bool includeCode
                  )
 {
     mActivityThread    = activityThread;
     mApplicationInfo   = aInfo;
     mPackageName       = aInfo.packageName;
     mAppDir            = aInfo.sourceDir;
     mResDir            = aInfo.uid == android.os.Process.myUid() ? aInfo.sourceDir : aInfo.publicSourceDir;
     mSharedLibraries   = aInfo.sharedLibraryFiles;
     mDataDir           = aInfo.dataDir;
     mDataDirFile       = mDataDir != null ? new java.io.File(mDataDir) : null;
     mLibDir            = aInfo.nativeLibraryDir;
     mBaseClassLoader   = baseLoader;
     mSecurityViolation = securityViolation;
     mIncludeCode       = includeCode;
     mCompatibilityInfo.set(compatInfo);
     if (mAppDir == null)
     {
         if (android.app.ActivityThread.mSystemContext == null)
         {
             android.app.ActivityThread.mSystemContext = android.app.ContextImpl.createSystemContext
                                                             (mainThread);
             android.app.ActivityThread.mSystemContext.getResources().updateConfiguration(mainThread
                                                                                          .getConfiguration(), mainThread.getDisplayMetricsLocked(compatInfo, false), compatInfo
                                                                                          );
         }
         //Slog.i(TAG, "Created system resources "
         //        + mSystemContext.getResources() + ": "
         //        + mSystemContext.getResources().getConfiguration());
         mClassLoader = android.app.ActivityThread.mSystemContext.getClassLoader();
         mResources   = android.app.ActivityThread.mSystemContext.getResources();
     }
 }
コード例 #7
0
ファイル: ComponentInfo.cs プロジェクト: zhouweiaccp/XobotOS
 public ComponentInfo(android.content.pm.ComponentInfo orig) : base(orig)
 {
     applicationInfo = orig.applicationInfo;
     processName     = orig.processName;
     descriptionRes  = orig.descriptionRes;
     enabled         = orig.enabled;
     exported        = orig.exported;
 }
コード例 #8
0
ファイル: ComponentInfo.cs プロジェクト: hakeemsm/XobotOS
		public ComponentInfo(android.content.pm.ComponentInfo orig) : base(orig)
		{
			applicationInfo = orig.applicationInfo;
			processName = orig.processName;
			descriptionRes = orig.descriptionRes;
			enabled = orig.enabled;
			exported = orig.exported;
		}
コード例 #9
0
ファイル: ComponentInfo.cs プロジェクト: zhouweiaccp/XobotOS
 protected internal ComponentInfo(android.os.Parcel source) : base(source)
 {
     applicationInfo = android.content.pm.ApplicationInfo.CREATOR.createFromParcel(source
                                                                                   );
     processName    = source.readString();
     descriptionRes = source.readInt();
     enabled        = (source.readInt() != 0);
     exported       = (source.readInt() != 0);
 }
コード例 #10
0
 public virtual void bindApplication(string packageName, android.content.pm.ApplicationInfo
                                     info, java.util.List <android.content.pm.ProviderInfo> providers, android.content.ComponentName
                                     testName, string profileName, android.os.ParcelFileDescriptor profileFd, bool autoStopProfiler
                                     , android.os.Bundle testArgs, android.app.IInstrumentationWatcher testWatcher, int
                                     debugMode, bool restrictedBackupMode, bool persistent, android.content.res.Configuration
                                     config, android.content.res.CompatibilityInfo compatInfo, java.util.Map <string,
                                                                                                              android.os.IBinder> services, android.os.Bundle coreSettings)
 {
     throw new System.NotImplementedException();
 }
コード例 #11
0
ファイル: ApplicationInfo.cs プロジェクト: zffl/androidmono
 public virtual int compare(android.content.pm.ApplicationInfo arg0, android.content.pm.ApplicationInfo arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(@__env.CallIntMethod(this.JvmHandle, global::android.content.pm.ApplicationInfo.DisplayNameComparator._compare1853, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1)));
     }
     else
     {
         return(@__env.CallNonVirtualIntMethod(this.JvmHandle, global::android.content.pm.ApplicationInfo.DisplayNameComparator.staticClass, global::android.content.pm.ApplicationInfo.DisplayNameComparator._compare1853, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1)));
     }
 }
コード例 #12
0
ファイル: LoadedApk.cs プロジェクト: zhouweiaccp/XobotOS
 /// <summary>
 /// Gets the array of shared libraries that are listed as
 /// used by the given package.
 /// </summary>
 /// <remarks>
 /// Gets the array of shared libraries that are listed as
 /// used by the given package.
 /// </remarks>
 /// <param name="packageName">
 /// the name of the package (note: not its
 /// file name)
 /// </param>
 /// <returns>
 /// null-ok; the array of shared libraries, each one
 /// a fully-qualified path
 /// </returns>
 private static string[] getLibrariesFor(string packageName)
 {
     android.content.pm.ApplicationInfo ai = null;
     try
     {
         ai = android.app.ActivityThread.getPackageManager().getApplicationInfo(packageName
                                                                                , android.content.pm.PackageManager.GET_SHARED_LIBRARY_FILES);
     }
     catch (android.os.RemoteException e)
     {
         throw new java.lang.AssertionError(e);
     }
     if (ai == null)
     {
         return(null);
     }
     return(ai.sharedLibraryFiles);
 }
コード例 #13
0
ファイル: LoadedApk.cs プロジェクト: zhouweiaccp/XobotOS
 public LoadedApk(android.app.ActivityThread activityThread, string name, android.content.Context
                  systemContext, android.content.pm.ApplicationInfo info, android.content.res.CompatibilityInfo
                  compatInfo)
 {
     mActivityThread              = activityThread;
     mApplicationInfo             = info != null ? info : new android.content.pm.ApplicationInfo();
     mApplicationInfo.packageName = name;
     mPackageName       = name;
     mAppDir            = null;
     mResDir            = null;
     mSharedLibraries   = null;
     mDataDir           = null;
     mDataDirFile       = null;
     mLibDir            = null;
     mBaseClassLoader   = null;
     mSecurityViolation = false;
     mIncludeCode       = true;
     mClassLoader       = systemContext.getClassLoader();
     mResources         = systemContext.getResources();
     mCompatibilityInfo.set(compatInfo);
 }
コード例 #14
0
ファイル: LoadedApk.cs プロジェクト: hakeemsm/XobotOS
		public LoadedApk(android.app.ActivityThread activityThread, string name, android.content.Context
			 systemContext, android.content.pm.ApplicationInfo info, android.content.res.CompatibilityInfo
			 compatInfo)
		{
			mActivityThread = activityThread;
			mApplicationInfo = info != null ? info : new android.content.pm.ApplicationInfo();
			mApplicationInfo.packageName = name;
			mPackageName = name;
			mAppDir = null;
			mResDir = null;
			mSharedLibraries = null;
			mDataDir = null;
			mDataDirFile = null;
			mLibDir = null;
			mBaseClassLoader = null;
			mSecurityViolation = false;
			mIncludeCode = true;
			mClassLoader = systemContext.getClassLoader();
			mResources = systemContext.getResources();
			mCompatibilityInfo.set(compatInfo);
		}
コード例 #15
0
 public abstract void scheduleCreateBackupAgent(android.content.pm.ApplicationInfo
                                                arg1, android.content.res.CompatibilityInfo arg2, int arg3);
コード例 #16
0
 public abstract void scheduleDestroyBackupAgent(android.content.pm.ApplicationInfo
                                                 arg1, android.content.res.CompatibilityInfo arg2);
コード例 #17
0
ファイル: ApplicationInfo.cs プロジェクト: zffl/androidmono
 public ApplicationInfo(android.content.pm.ApplicationInfo arg0)  : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv         @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.content.pm.ApplicationInfo.staticClass, global::android.content.pm.ApplicationInfo._ApplicationInfo1862, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     Init(@__env, handle);
 }
コード例 #18
0
ファイル: ComponentInfo.cs プロジェクト: hakeemsm/XobotOS
		protected internal ComponentInfo(android.os.Parcel source) : base(source)
		{
			applicationInfo = android.content.pm.ApplicationInfo.CREATOR.createFromParcel(source
				);
			processName = source.readString();
			descriptionRes = source.readInt();
			enabled = (source.readInt() != 0);
			exported = (source.readInt() != 0);
		}
コード例 #19
0
ファイル: LoadedApk.cs プロジェクト: hakeemsm/XobotOS
		/// <summary>
		/// Create information about a new .apk
		/// NOTE: This constructor is called with ActivityThread's lock held,
		/// so MUST NOT call back out to the activity manager.
		/// </summary>
		/// <remarks>
		/// Create information about a new .apk
		/// NOTE: This constructor is called with ActivityThread's lock held,
		/// so MUST NOT call back out to the activity manager.
		/// </remarks>
		public LoadedApk(android.app.ActivityThread activityThread, android.content.pm.ApplicationInfo
			 aInfo, android.content.res.CompatibilityInfo compatInfo, android.app.ActivityThread
			 mainThread, java.lang.ClassLoader baseLoader, bool securityViolation, bool includeCode
			)
		{
			mActivityThread = activityThread;
			mApplicationInfo = aInfo;
			mPackageName = aInfo.packageName;
			mAppDir = aInfo.sourceDir;
			mResDir = aInfo.uid == android.os.Process.myUid() ? aInfo.sourceDir : aInfo.publicSourceDir;
			mSharedLibraries = aInfo.sharedLibraryFiles;
			mDataDir = aInfo.dataDir;
			mDataDirFile = mDataDir != null ? new java.io.File(mDataDir) : null;
			mLibDir = aInfo.nativeLibraryDir;
			mBaseClassLoader = baseLoader;
			mSecurityViolation = securityViolation;
			mIncludeCode = includeCode;
			mCompatibilityInfo.set(compatInfo);
			if (mAppDir == null)
			{
				if (android.app.ActivityThread.mSystemContext == null)
				{
					android.app.ActivityThread.mSystemContext = android.app.ContextImpl.createSystemContext
						(mainThread);
					android.app.ActivityThread.mSystemContext.getResources().updateConfiguration(mainThread
						.getConfiguration(), mainThread.getDisplayMetricsLocked(compatInfo, false), compatInfo
						);
				}
				//Slog.i(TAG, "Created system resources "
				//        + mSystemContext.getResources() + ": "
				//        + mSystemContext.getResources().getConfiguration());
				mClassLoader = android.app.ActivityThread.mSystemContext.getClassLoader();
				mResources = android.app.ActivityThread.mSystemContext.getResources();
			}
		}
コード例 #20
0
        public CompatibilityInfo(android.content.pm.ApplicationInfo appInfo, int screenLayout
                                 , int sw, bool forceCompat)
        {
            int compatFlags = 0;

            if (appInfo.requiresSmallestWidthDp != 0 || appInfo.compatibleWidthLimitDp != 0 ||
                appInfo.largestWidthLimitDp != 0)
            {
                // New style screen requirements spec.
                int required = appInfo.requiresSmallestWidthDp != 0 ? appInfo.requiresSmallestWidthDp
                                         : appInfo.compatibleWidthLimitDp;
                if (required == 0)
                {
                    required = appInfo.largestWidthLimitDp;
                }
                int compat = appInfo.compatibleWidthLimitDp != 0 ? appInfo.compatibleWidthLimitDp
                                         : required;
                if (compat < required)
                {
                    compat = required;
                }
                int largest = appInfo.largestWidthLimitDp;
                if (required > DEFAULT_NORMAL_SHORT_DIMENSION)
                {
                    // For now -- if they require a size larger than the only
                    // size we can do in compatibility mode, then don't ever
                    // allow the app to go in to compat mode.  Trying to run
                    // it at a smaller size it can handle will make it far more
                    // broken than running at a larger size than it wants or
                    // thinks it can handle.
                    compatFlags |= NEVER_NEEDS_COMPAT;
                }
                else
                {
                    if (largest != 0 && sw > largest)
                    {
                        // If the screen size is larger than the largest size the
                        // app thinks it can work with, then always force it in to
                        // compatibility mode.
                        compatFlags |= NEEDS_SCREEN_COMPAT | ALWAYS_NEEDS_COMPAT;
                    }
                    else
                    {
                        if (compat >= sw)
                        {
                            // The screen size is something the app says it was designed
                            // for, so never do compatibility mode.
                            compatFlags |= NEVER_NEEDS_COMPAT;
                        }
                        else
                        {
                            if (forceCompat)
                            {
                                // The app may work better with or without compatibility mode.
                                // Let the user decide.
                                compatFlags |= NEEDS_SCREEN_COMPAT;
                            }
                        }
                    }
                }
                // Modern apps always support densities.
                applicationDensity       = android.util.DisplayMetrics.DENSITY_DEVICE;
                applicationScale         = 1.0f;
                applicationInvertedScale = 1.0f;
            }
            else
            {
                int EXPANDABLE     = 2;
                int LARGE_SCREENS  = 8;
                int XLARGE_SCREENS = 32;
                int sizeInfo       = 0;
                // We can't rely on the application always setting
                // FLAG_RESIZEABLE_FOR_SCREENS so will compute it based on various input.
                bool anyResizeable = false;
                if ((appInfo.flags & android.content.pm.ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS
                     ) != 0)
                {
                    sizeInfo     |= LARGE_SCREENS;
                    anyResizeable = true;
                    if (!forceCompat)
                    {
                        // If we aren't forcing the app into compatibility mode, then
                        // assume if it supports large screens that we should allow it
                        // to use the full space of an xlarge screen as well.
                        sizeInfo |= XLARGE_SCREENS | EXPANDABLE;
                    }
                }
                if ((appInfo.flags & android.content.pm.ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS
                     ) != 0)
                {
                    anyResizeable = true;
                    if (!forceCompat)
                    {
                        sizeInfo |= XLARGE_SCREENS | EXPANDABLE;
                    }
                }
                if ((appInfo.flags & android.content.pm.ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS
                     ) != 0)
                {
                    anyResizeable = true;
                    sizeInfo     |= EXPANDABLE;
                }
                if (forceCompat)
                {
                    // If we are forcing compatibility mode, then ignore an app that
                    // just says it is resizable for screens.  We'll only have it fill
                    // the screen if it explicitly says it supports the screen size we
                    // are running in.
                    sizeInfo &= ~EXPANDABLE;
                }
                compatFlags |= NEEDS_SCREEN_COMPAT;
                switch (screenLayout & android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK)
                {
                case android.content.res.Configuration.SCREENLAYOUT_SIZE_XLARGE:
                {
                    if ((sizeInfo & XLARGE_SCREENS) != 0)
                    {
                        compatFlags &= ~NEEDS_SCREEN_COMPAT;
                    }
                    if ((appInfo.flags & android.content.pm.ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS
                         ) != 0)
                    {
                        compatFlags |= NEVER_NEEDS_COMPAT;
                    }
                    break;
                }

                case android.content.res.Configuration.SCREENLAYOUT_SIZE_LARGE:
                {
                    if ((sizeInfo & LARGE_SCREENS) != 0)
                    {
                        compatFlags &= ~NEEDS_SCREEN_COMPAT;
                    }
                    if ((appInfo.flags & android.content.pm.ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS
                         ) != 0)
                    {
                        compatFlags |= NEVER_NEEDS_COMPAT;
                    }
                    break;
                }
                }
                if ((screenLayout & android.content.res.Configuration.SCREENLAYOUT_COMPAT_NEEDED)
                    != 0)
                {
                    if ((sizeInfo & EXPANDABLE) != 0)
                    {
                        compatFlags &= ~NEEDS_SCREEN_COMPAT;
                    }
                    else
                    {
                        if (!anyResizeable)
                        {
                            compatFlags |= ALWAYS_NEEDS_COMPAT;
                        }
                    }
                }
                else
                {
                    compatFlags &= ~NEEDS_SCREEN_COMPAT;
                    compatFlags |= NEVER_NEEDS_COMPAT;
                }
                if ((appInfo.flags & android.content.pm.ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES
                     ) != 0)
                {
                    applicationDensity       = android.util.DisplayMetrics.DENSITY_DEVICE;
                    applicationScale         = 1.0f;
                    applicationInvertedScale = 1.0f;
                }
                else
                {
                    applicationDensity = android.util.DisplayMetrics.DENSITY_DEFAULT;
                    applicationScale   = android.util.DisplayMetrics.DENSITY_DEVICE / (float)android.util.DisplayMetrics
                                         .DENSITY_DEFAULT;
                    applicationInvertedScale = 1.0f / applicationScale;
                    compatFlags |= SCALING_REQUIRED;
                }
            }
            mCompatibilityFlags = compatFlags;
        }
コード例 #21
0
 public java.lang.CharSequence getDisplayName(android.content.Context context, string
                                              packageName, android.content.pm.ApplicationInfo appInfo)
 {
     throw new System.NotImplementedException();
 }
コード例 #22
0
 public virtual void scheduleDestroyBackupAgent(android.content.pm.ApplicationInfo
                                                app, android.content.res.CompatibilityInfo compatInfo)
 {
     throw new System.NotImplementedException();
 }